Creating a Custom User Model For Authentication | Learn Django REST Framework #7
ฝัง
- เผยแพร่เมื่อ 12 ก.ย. 2024
- We create a custom User model that we shall use for authenticating our users. This model is created using the AbstractUser class.
SOURCE CODE:
github.com/jod...
FOLLOW ME:
GITHUB:
github.com/jod35
TWITTER:
/ jod35_
Great Exaplanation Ssali! Thanks 🙌
Glad you liked it.
In 8:26 you replace two strings at the same time by writing only one string. How do you do that?
Ctrl + D
22:12 I can't create new post since I believe you set the viewsets. At this point, are you working with the mixins class from previous videos or you just made a post viewset? Thank you!
I am using the previous logic.
really great, thanks
Glad it helped
I have a problem after createsuperuser >>> data to long for column 'password' at row 1 22001
Can you please check your user model? chances may be high that you have the password field having a max_length that is short.
@@SsaliJonathan thank you 🙌
i have a problem with my code, after creating my superuser, i login and have no information on my admin page
Have you registered your models with the admin site?
Thank you! 👏👏👏
Glad it helped
Awesome. Thanks
I am really glad you liked the video
how do I do social authentication on top of this ?
Hi. Please check out a Django package called Django AllAuth
Thanks bro
Glad you liked it
@@SsaliJonathan I follow you from Azerbaijan and I like your videos🖤
i've tried to pass like this:
AUTH_USER_MODEL = "core.CustomUser"
and the full path to the model is:
core/models/account_models.py
in the terminal the output is this:
django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'core.CustomUser' that has not been installed
check if you have the core in your INSTALLED_APPS list
Why email isnt models.EmailField?
well, it is just some small mistake that I made during recording.
How to log out the user?
Hey man, check out my videos on JWT authentication. Logging out happens when an access token expires. Logging back in will happen when we use a fresh token to aquire a fresh JWT.
Awesome, thanks