AttributeError: 'bool' object has no attribute 'drivername' code example

Example 1: AttributeError: 'builtin_function_or_method' object has no attribute 'randrange'

import random as rand
# and when using it, type rand instead of random
rows, cols = (10, 10)
arr = [[rand.randrange(10) for i in range(cols)] for j in range(rows)]
print(arr)

Example 2: AttributeError: module 'django.contrib.auth.views' has no attribute 'login'

from django.contrib.auth import views as auth_views

urlpatterns = [
   url( r'^login/$',auth_views.LoginView.as_view(template_name="useraccounts/login.html"), name="login"),
]