1# user in the login should be a User Object not the username.
2
3from django.contrib.auth.models import User
4
5def get_django_user_by_username(username):
6 """Get the django user
7 Args:
8 username (str): email id of the user
9 Returns:
10 object: django user object
11 """
12 return User.objects.filter(username=username).first()
13
14user = get_django_user_by_username(email)
15
16login(request, user, backend="django.contrib.auth.backends.ModelBackend")
17
1 AttributeError: can be defined as an error that is raised when an attribute
2 reference or assignment fails.
1This happens because the scipy module doesn't have any attribute named sparse. That attribute only gets defined when you import scipy.sparse.
2
3Submodules don't automatically get imported when you just import scipy; you need to import them explicitly. The same holds for most packages, although a package can choose to import its own submodules if it wants to. (For example, if scipy/__init__.py included a statement import scipy.sparse, then the sparse submodule would be imported whenever you import scipy.)
1BaseException
2 +-- SystemExit
3 +-- KeyboardInterrupt
4 +-- GeneratorExit
5 +-- Exception
6 +-- StopIteration
7 +-- StopAsyncIteration
8 +-- ArithmeticError
9 | +-- FloatingPointError
10 | +-- OverflowError
11 | +-- ZeroDivisionError
12 +-- AssertionError
13 +-- AttributeError
14 +-- BufferError
15 +-- EOFError
16 +-- ImportError
17 | +-- ModuleNotFoundError
18 +-- LookupError
19 | +-- IndexError
20 | +-- KeyError
21 +-- MemoryError
22 +-- NameError
23 | +-- UnboundLocalError
24 +-- OSError
25 | +-- BlockingIOError
26 | +-- ChildProcessError
27 | +-- ConnectionError
28 | | +-- BrokenPipeError
29 | | +-- ConnectionAbortedError
30 | | +-- ConnectionRefusedError
31 | | +-- ConnectionResetError
32 | +-- FileExistsError
33 | +-- FileNotFoundError
34 | +-- InterruptedError
35 | +-- IsADirectoryError
36 | +-- NotADirectoryError
37 | +-- PermissionError
38 | +-- ProcessLookupError
39 | +-- TimeoutError
40 +-- ReferenceError
41 +-- RuntimeError
42 | +-- NotImplementedError
43 | +-- RecursionError
44 +-- SyntaxError
45 | +-- IndentationError
46 | +-- TabError
47 +-- SystemError
48 +-- TypeError
49 +-- ValueError
50 | +-- UnicodeError
51 | +-- UnicodeDecodeError
52 | +-- UnicodeEncodeError
53 | +-- UnicodeTranslateError
54 +-- Warning
55 +-- DeprecationWarning
56 +-- PendingDeprecationWarning
57 +-- RuntimeWarning
58 +-- SyntaxWarning
59 +-- UserWarning
60 +-- FutureWarning
61 +-- ImportWarning
62 +-- UnicodeWarning
63 +-- BytesWarning
64 +-- ResourceWarning
65