code: def login_generic(request, username, password):
          
          user = authenticate(username=username, password=password)
          if user is not None and user.is_active:
              login(request, user)
              return True
          return False
docs: Helper method. Generic login with username and password.