Really helpful video man. I don't know how this video doesn't have the likes quantity that it deserves !!!!! I just want to tell you that you got a new sub now
justin i buy your lots of udemy courses and let me tell you one thing..you are the mentor i always wish for..and i call you sir amd you are my teacher and i also wish that someday i will you meet you face to face..thank you sir
just found you sitting here with all i need exactly! i'm so frustrated with this problem from days. well thanks to angels like you on earth to save my a**. appreciate your work again thanks man!
HAHA & AHA 😂 I just had that error a few days ago 25:48 My learning process is extremely 😁😝 😬 ,.. 1.i get the error 2.contemplate.. 🤔 3. get 😞😐 and then a few days.. 4. get frustrated, 5. erase 6. try again 7. then you see related videos / blogs about it.. after a few days / months/ of finally recovering from every failure 😂 Thank you for this video...:
if you get "AttributeError: 'Manager' object has no attribute 'get_by_natural_key' " when creating a superuser try including PermissionsMixin and adding it to the User class. Also add "objects = UserManager ()" the class.
I thought the User had much more than 3 fields. e.g is_active, is_staff, username, email, passwprd, so what's all this about with only 3 fields? If the default User model is extended when you use AbstractUser then shouldn't it also inherit the rest of the fields that come with the User model?
Thank u very much! You helped me a lot, I was getting crazy with this lol. But I have a question, do you have any video that teaches how to work with two forms in the same view ? greetings from Brazil!
This is great. One thing I have been trying to model correctly is the situation where you want to record details of people who may not be users, for example, they may be a supplier contact or an internal contact, the complexity being that they may become a user and that record should be related to the user account. Is there a standard way to handle that?
Amazing tutorial..! I could create a custom model and able to register new users. But after making this change, the admin login is not working? Any guess on what could have gone wrong? I'm using django 1.11.12 Thanks in advance!
Quick ques: Instead of inheriting AbstractBaseUser, can't I inherit AbstractUser since it already has all these boolean fields that we created ? Thanks !
hi, when I try to delete a user I get the following error: IntegrityError at / admin / userprofile / myuser / 23 / delete / FOREIGN KEY constraint failed. Has it happened to someone the same?
Hi Justin If I use a third-party authentication service (such as oauth2) to register/login my users with their email and password, do I still need to use the custom User model on this video ?
Can I create two custom users, one for an employee and the other for the company ? The idea is the employee can register and login to create his CV, then the company also can register, login to check CVs.
Thanks a lot man, that really helped a lot. On a side note can you please tell how can i integrate this with a social media login like Facebook or Google. Thanks in advance :)
Not providing a setter for User @property is_staff and is_admin causes UserManager.create_staffuser and UserManager.create_superuser to fail. (Django=5.0.4). Wonder if I should provide a setter for these or if that is a potential security hole (is there some way for a rogue page to change is_admin=True via a User object)
I didn't follow your guide, but I did something similar... And it seems correct after seeing your video. My signup, login, logout, remember, email confirmation works... But I can't get password to be reset, using django-allauth! I can't get any information on the web, it has something to do with the reverve not matching for uidb36/key, etc. My custom user does not have a username; Any ideas?
bro i used pycharm and are install pillow but not work what is problem? and i used sublime when create makemigrations their show "no changes detect" what is problem?
Is it possible to have multiple custom user authentication methods for different users within the same Django app. Like an email and password for one type of user and a pin only for another type of user. Someone please shed some light
Hi, I'm very confused with the whole staff admin thing. Do we not create the regular user? From what I've read staff and admin can log in to the admin side. I'm trying to create a User Model where user can be one of 3 roles: - Course Chair - Course Creator and finally - Admin. Only Admin can log in to the admin page. So in my model, do I do: is_course_chair or is_staff or nothing?
to add image field you have to install Pillow (python's library that handles files) and inside your models.py file you can use models.ImageField(upload_to='media'). To save it inside the database make sure you have specified your media root and url in settings.py. I would suggest you watch a youtube video on how to upload media files in django it is very easy.
I am always getting this error - "Please enter the correct email address and password for a staff account. Note that both fields may be case-sensitive."
@@timetosleep8055 check if you have declared is_staff in the model. If yes then check if you are passing that value to be True for the user u want to create. is_staff = True required for the user to have admin access.
I'm wondering why we can't use email for the field username ( it's not forbidden) and then just go on with the built-in User instead of creating completely new custom User ? Thx in advance.
Hey justin, all looks good and works except testing. The moment you introduce a custom user model the order in which migrations are executed starts to matter. This is not a problem in that you can fire 1) `python manage.py makemigrations accounts` first, then 2) `python manage.py makemigrations` and finally 3) `python manage.py migrate`. Unfortunately, this breaks django testing. Django testing uses the DiscoverRunner under the hood which will only call plain old 1) `python manage.py makemigrations` and 2) `python manage.py migrate`. Whenever it does so, the error occurs and you cannot workaround this because you cannot control the make migration order. Do you know a solution to this?
Hi, I am learning the Custom Django User Model. All the things work fine but at 40:02 when I am copying the UserAdminCreationForm and UserAdminChangeForm from the website provided, I am getting this error "django.core.exceptions.FieldError: Unknown field(s) (is_active) specified for User". Anyone can provide a solution. Thanks in advance.
Hello Sir, Can you please explain to me clearly how can i populate information to update user profile so the form must look exactly like the way it looks on template without changing the form structure, i want info to be on below input fields thank you in advance.
Hello Justin.. I'm having a little challenge here... Tried to modify the codes by adding first name /last name to the form.py and it would not show on the database.. Instead I get the error accounts_myuser.first_name has no such colum first_name Please how can I fix this
heey after setting the settins to auth_use_model to accounts.use and creating a superuser with email and fullname when i go to admin and sign in it tells me that i enterred the false email or password nd im sure that theyr true , i created anotjer user but the same problem still , i elimnates the auth_user_model from settings and i created a super iser normally it workid when i sign in !!! what should i do please am stuck
Hi Justin. Quick question: At 49:08 I don't understand the field add_fieldsets. Why don't you change that too? And if I warry it in my code, it seems to affect nothing. Why is that field even in there and what does it do?
And also another questions: Changing the forms also doesn't change anything if I implemented the fieldsets. Why do we have to have the form, if they seem to not affect anything?
@@CodingEntrepreneurs What determines whether a field is shown in the admin view? For example 45:21, you add full_name to the ChangeForm, and then you add it to fieldsets. Does it have to be added in both? What exactly is the point of adding it in the Meta class of the form? Because I can just do ' fields = () ' in my form Meta class and it works. Is there something wrong with that?
CodingEntrepreneurs , how come your Django is so fast and responsive even when it is just a development server. When I do Django, there is still some lags during refreshes while in your video, it's so snappy and responsive like a Single Page Application.
@@CodingEntrepreneurs well, I do have 16 GB of RAM. Maybe it's all those tabs I open in Chrome. When I'm coding, I oftentimes forget that I'm opening a lot of tabs for reference. Maybe that's what's contributing to the slowdown.
I am getttin this error when i try to migrate django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'accounts.NewUser' that has not been installed. The accounts app is installed in the settings under installed apps
Does this work with Django 2.0??? I can't seem to get it working after I finish when I edit the user I get an error... I posted a comment on your tutorial.
I have the same problem and Ive seen your question also on StackFlow. Have you by chance found any solution to this? Everything was sound up to this point
Ive just found the solution, hope you read this my friend. Ive dropped the database and rebuilt it.- python manage.py sqlflush- and re-ren migrations. eveyrthing works fine. I think it is a problem with adding new fields to the User model
Django 2.1 will be written completely different and some things are already done for you ect.. so if you are using 2.1+ then you will want to look up a newer tutorial -- but regardless of that -- below Yeah, if you change to a custom user model you need to start over with your database, so for one its really smart to start with a custom user model anyways even if very basic, then second important factor is if your data is important then you have to figure out how to copy the data from the old to new database but you will need to "delete" the old so it can make new, also clear every migration folder of everything except the "__init__" file then once you change the model makemigration (appname) and then migrate (appname) and your new model should be up and running if its good.
I have a small issue. I can no longer login in the admin interface with the superuser account. I deleted the database, made new superusers, but the same thing happens. The user is created, but I can't login with it. Any ideas?
At ruclips.net/video/HshbjK1vDtY/видео.html&t=2660 , after you define the error, shouldn't you be adding the line -user_obj.full_name = full_name- to the create_user function? How did you manage to create a superuser without that line?
Hi, I think we use "if" to announce that user need to type down the email then looking on your code I think it still do the next line of code after alarm the needed of email. CodingEntrepreneurs ruclips.net/video/HshbjK1vDtY/видео.html
Hi, i’m currently making a django base system. I need to create multiple users but with different control to the system. One of these users can only add and view while the others can delete and edit what’s on the system
Should I update this video? It's 2022 -- perhaps it's time? Please comment!
Well im only speak spanish, but i can say "Please do it, we need it"
Please Do It. ❤️✌🏻
Please do it ASAP
Yes!
It will be great.
❣
Finally, someone from dev world who is not trolling with soft skill videos, and providing useful content.Well done, Sir.
2023 and this is still very relevant to me thank you so much
Man, you are making Django even more pupular, making this awesome, great detailed but complete tutorials. Keep going.
Justin, you are the man! Really appreciate this upload bra!
Really helpful video man. I don't know how this video doesn't have the likes quantity that it deserves !!!!! I just want to tell you that you got a new sub now
Thank you!
justin i buy your lots of udemy courses and let me tell you one thing..you are the mentor i always wish for..and i call you sir amd you are my teacher and i also wish that someday i will you meet you face to face..thank you sir
YOU ARE THE BEST! 👏🏻👏🏻👏🏻👏🏻 That was some goddamn awesome explanation.
just found you sitting here with all i need exactly! i'm so frustrated with this problem from days. well thanks to angels like you on earth to save my a**. appreciate your work again thanks man!
hey.. best tutorial ever on youtube.. n i can say coding entrepreneur is the best resource to learn django.. ❣️❣️💪🏾
HAHA & AHA 😂 I just had that error a few days ago 25:48
My learning process is extremely 😁😝 😬 ,..
1.i get the error
2.contemplate.. 🤔
3. get 😞😐 and then a few days..
4. get frustrated,
5. erase
6. try again
7. then you see related videos / blogs about it.. after a few days / months/ of finally recovering from every failure 😂
Thank you for this video...:
Justin is on fire
+G cloud you are! 🔥🔥
Back to this episode from 2022, so good 🫰😃
Much appreciation for this video Justin! I learnt a lot
After disliking few youtubers,I am feeling fortunate by pressing the like button
U deserve millions of subscribers!
if you get "AttributeError: 'Manager' object has no attribute 'get_by_natural_key' " when creating a superuser try including PermissionsMixin and adding it to the User class. Also add "objects = UserManager ()" the class.
add the following to your user model: objects = UserManager()
Really Nice and clear explanation!!
Wow. This is a brilliant explanation. Wowwwwwwwww.... Thank you very much
Amazing video!! Really helpful.
+Ali Khundmiri thank you!
Thank you so much for ur guides
Justin you are the best!
Dear sir my name is Mustafa Warsi it very Awesome, I am a YOUR BIG FAN
how you become so expert on django. share your story. we would love to hear
Like you do with everything in life. Experience, reading docs, dealing with problems and solving those problems. Googling. That's pretty much it.
thank you so much man. respect for your work
any tutorial about how to adding logo in admin with name thank you...
Thank You so Much Justin
i love this channel.
Tnx for your tutorial U R the best
I thought the User had much more than 3 fields. e.g is_active, is_staff, username, email, passwprd, so what's all this about with only 3 fields?
If the default User model is extended when you use AbstractUser then shouldn't it also inherit the rest of the fields that come with the User model?
Yes pls, make a vlog of your leanings
great video
thnk u, well explain
You sir, are a lifesaver. Thank you for making this.
Thank u very much! You helped me a lot, I was getting crazy with this lol. But I have a question, do you have any video that teaches how to work with two forms in the same view ?
greetings from Brazil!
really good
Great Tutorial!!!
This is great. One thing I have been trying to model correctly is the situation where you want to record details of people who may not be users, for example, they may be a supplier contact or an internal contact, the complexity being that they may become a user and that record should be related to the user account. Is there a standard way to handle that?
Any video on AbstractUser instead of AbstractBaseUser ??
Amazing tutorial..!
I could create a custom model and able to register new users. But after making this change, the admin login is not working?
Any guess on what could have gone wrong? I'm using django 1.11.12
Thanks in advance!
same here, i cant login to the admin panel with staff user, which was created by superuser
Quick ques: Instead of inheriting AbstractBaseUser, can't I inherit AbstractUser since it already has all these boolean fields that we created ? Thanks !
I’m sure it’s fine!
hi, when I try to delete a user I get the following error: IntegrityError at / admin / userprofile / myuser / 23 / delete /
FOREIGN KEY constraint failed.
Has it happened to someone the same?
Thanks man.
Can I watch this in 2020, does it require any changes according to django version?
No
Hi Justin
If I use a third-party authentication service (such as oauth2) to register/login my users with their email and password, do I still need to use the custom User model on this video ?
Can I create two custom users, one for an employee and the other for the company ? The idea is the employee can register and login to create his CV, then the company also can register, login to check CVs.
everything is working perfectly but i am not able to create staff user by admin page
Hello Sir, Can we put a autofield to custom user model???
Thanks a lot man, that really helped a lot. On a side note can you please tell how can i integrate this with a social media login like Facebook or Google.
Thanks in advance :)
hello Justin, your guide was really helpful, please could I reference it in my tutorial?
For sure!
Justin when are you going to put a new update version of this course on Udemy...??..by the I love your django series in udemy
Not providing a setter for User @property is_staff and is_admin causes UserManager.create_staffuser and UserManager.create_superuser to fail. (Django=5.0.4). Wonder if I should provide a setter for these or if that is a potential security hole (is there some way for a rogue page to change is_admin=True via a User object)
can u make a video for django-organization
I didn't follow your guide, but I did something similar... And it seems correct after seeing your video. My signup, login, logout, remember, email confirmation works... But I can't get password to be reset, using django-allauth! I can't get any information on the web, it has something to do with the reverve not matching for uidb36/key, etc. My custom user does not have a username; Any ideas?
bro i used pycharm and are install pillow but not work what is problem? and i used sublime when create makemigrations their show "no changes detect" what is problem?
do you have video / how do setting for sublime text editor whith context python/django ?
+Python My somewhere we do. What are you looking for exactly?
All you need to install to successfull use of st3 as python/django "ide" is Anaconda for python and MAYBE, just MAYBE Djanerio for django templates
I'm trying to inherit custom user to another class but it gets IntegrityError at /admin/User/student/add/
FOREIGN KEY constraint failed error
Is it possible to have multiple custom user authentication methods for different users within the same Django app. Like an email and password for one type of user and a pin only for another type of user. Someone please shed some light
Hi, I'm very confused with the whole staff admin thing. Do we not create the regular user? From what I've read staff and admin can log in to the admin side. I'm trying to create a User Model where user can be one of 3 roles:
- Course Chair
- Course Creator
and finally
- Admin.
Only Admin can log in to the admin page.
So in my model, do I do:
is_course_chair
or
is_staff
or
nothing?
How do we add more fields like profile image, city etc during registration.
to add image field you have to install Pillow (python's library that handles files) and inside your models.py file you can use models.ImageField(upload_to='media').
To save it inside the database make sure you have specified your media root and url in settings.py.
I would suggest you watch a youtube video on how to upload media files in django it is very easy.
Hi ,
How to add a model field that shows today date . This date field should get automatically updated to todays date
Hey Justin, I want only those users to login in Admin Page who are already logged in.
And Show 404 otherwise
I am always getting this error - "Please enter the correct email address and password for a staff account. Note that both fields may be case-sensitive."
@@timetosleep8055 check if you have declared is_staff in the model. If yes then check if you are passing that value to be True for the user u want to create. is_staff = True required for the user to have admin access.
Can you please suggest any third party authentication system that supports this custom user model along with latest 3.11 Django Rest Framework Please.
Django AllAuth and django-rest-auth.readthedocs.io/en/latest/installation.html
I'm wondering why we can't use email for the field username ( it's not forbidden) and then just go on with the built-in User instead of creating completely new custom User ? Thx in advance.
How do you combine it with the HTML file that the question, and why it is not part of your tutorial?
Does this still work in 2020 guys ?
this can be helpfully:
find . -path "*/migrations/*.py" -not -name "__init__.py" -delete
find . -path "*/migrations/*.pyc" -delete
+tor root sweet thanks!
Hey justin, all looks good and works except testing. The moment you introduce a custom user model the order in which migrations are executed starts to matter. This is not a problem in that you can fire 1) `python manage.py makemigrations accounts` first, then 2) `python manage.py makemigrations` and finally 3) `python manage.py migrate`. Unfortunately, this breaks django testing. Django testing uses the DiscoverRunner under the hood which will only call plain old 1) `python manage.py makemigrations` and 2) `python manage.py migrate`. Whenever it does so, the error occurs and you cannot workaround this because you cannot control the make migration order. Do you know a solution to this?
Hey Justin where is gone you video about Django Forms and 1 hour long?I don't mind to pay for it.
can you make a custom password reset view for this model?
Hi, I am learning the Custom Django User Model. All the things work fine but at 40:02 when I am copying the UserAdminCreationForm and UserAdminChangeForm from the website provided, I am getting this error "django.core.exceptions.FieldError: Unknown field(s) (is_active) specified for User". Anyone can provide a solution. Thanks in advance.
change is_admin to admin
Hello Sir, Can you please explain to me clearly how can i populate information to update user profile so the form must look exactly like the way it looks on template without changing the form structure, i want info to be on below input fields thank you in advance.
Edit Profile
First Name
Last Name
E-Mail*
Website
Password*
Confirm Password*
Country
Profile Picture
Select file
Browse
About Yourself
Facebook
Twitter
Linkedin
Google plus
can create multiple superuser?
can you tell what is the use clean_password method in Userchangeform
**use of
Get natural key error when creating new superuser, please help
Doesn't work. Getting a crazy error that you can't do anything about. django.db.migrations.exceptions.InvalidBasesError: Cannot resolve bases for []
HI how can i join for your full course ????
Hello Justin.. I'm having a little challenge here... Tried to modify the codes by adding first name /last name to the form.py and it would not show on the database.. Instead I get the error accounts_myuser.first_name has no such colum first_name
Please how can I fix this
I am getting an error 'NoneType' object has no attribute 'save' when ever i try creating a new user from the admin .Please help
I am a beginner and my question is: is this valid for Django 3.0?
sure absolutely
when update this video ?
heey after setting the settins to auth_use_model to accounts.use and creating a superuser with email and fullname when i go to admin and sign in it tells me that i enterred the false email or password nd im sure that theyr true , i created anotjer user but the same problem still , i elimnates the auth_user_model from settings and i created a super iser normally it workid when i sign in !!! what should i do please am stuck
Hi Justin. Quick question:
At 49:08 I don't understand the field add_fieldsets. Why don't you change that too? And if I warry it in my code, it seems to affect nothing. Why is that field even in there and what does it do?
And also another questions: Changing the forms also doesn't change anything if I implemented the fieldsets. Why do we have to have the form, if they seem to not affect anything?
`add_fieldsets` is related to your "add new object" form.
What do you mean changing the forms doesn't change anything?
@@CodingEntrepreneurs What determines whether a field is shown in the admin view? For example 45:21, you add full_name to the ChangeForm, and then you add it to fieldsets.
Does it have to be added in both? What exactly is the point of adding it in the Meta class of the form?
Because I can just do ' fields = () ' in my form Meta class and it works. Is there something wrong with that?
With this method, every user that I create gets all permissions automatically. How can I limit permissions while creating new user?
For some reason my user's username is being displayed as ('username', )
Anyone else with the same problem?
CodingEntrepreneurs , how come your Django is so fast and responsive even when it is just a development server. When I do Django, there is still some lags during refreshes while in your video, it's so snappy and responsive like a Single Page Application.
Do you have a lot of apps running? Does your computer have a lot of RAM?
@@CodingEntrepreneurs well, I do have 16 GB of RAM. Maybe it's all those tabs I open in Chrome. When I'm coding, I oftentimes forget that I'm opening a lot of tabs for reference. Maybe that's what's contributing to the slowdown.
I am getttin this error when i try to migrate django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'accounts.NewUser' that has not been installed.
The accounts app is installed in the settings under installed apps
Where do i use that create_staffuser method in modelmanager
Does this work with Django 2.0??? I can't seem to get it working after I finish when I edit the user I get an error... I posted a comment on your tutorial.
I have the same problem and Ive seen your question also on StackFlow. Have you by chance found any solution to this? Everything was sound up to this point
Ive just found the solution, hope you read this my friend. Ive dropped the database and rebuilt it.- python manage.py sqlflush- and re-ren migrations. eveyrthing works fine. I think it is a problem with adding new fields to the User model
Django 2.1 will be written completely different and some things are already done for you ect.. so if you are using 2.1+ then you will want to look up a newer tutorial -- but regardless of that -- below
Yeah, if you change to a custom user model you need to start over with your database, so for one its really smart to start with a custom user model anyways even if very basic, then second important factor is if your data is important then you have to figure out how to copy the data from the old to new database but you will need to "delete" the old so it can make new, also clear every migration folder of everything except the "__init__" file then once you change the model makemigration (appname) and then migrate (appname) and your new model should be up and running if its good.
Is this working with django 2.1? I get foreign key error
I have a small issue. I can no longer login in the admin interface with the superuser account. I deleted the database, made new superusers, but the same thing happens. The user is created, but I can't login with it. Any ideas?
Make sure that active field is set to true. Try this: user_object.active = True
Then
user_object.save()
Then try to login.
I get a
FOREIGN KEY constraint failed when i try to create or delete a user, can anyone hlep me?
user = models.ForeignKey(AuthUser, unique=True,on_delete=models.DO_NOTHING)
just add on_delete=models.DO_NOTHING as an argument to the call function
FOREIGN KEY CONSTRAINT FAILED?? INTEGRITY ERROR??
help:
can not able to login in admin panel
TypeError: create_superuser() missing 1 required positional argument: 'full_name'
same here
ever found a solution for this?
Dear coders, You need to notice one thing that staff user can access admin console without permission...
This is an error, please solve it
inform us then
At ruclips.net/video/HshbjK1vDtY/видео.html&t=2660 , after you define the error, shouldn't you be adding the line -user_obj.full_name = full_name- to the create_user function? How did you manage to create a superuser without that line?
Hi, I think we use "if" to announce that user need to type down the email then looking on your code I think it still do the next line of code after alarm the needed of email.
CodingEntrepreneurs
ruclips.net/video/HshbjK1vDtY/видео.html
Hi, i’m currently making a django base system. I need to create multiple users but with different control to the system. One of these users can only add and view while the others can delete and edit what’s on the system
You could add an attribute to the user model called permissions and then adjust the view based on the permissions of the user.