No video

Multiple User Types | Django

  Рет қаралды 56,250

Daniel Roy Greenfeld

Daniel Roy Greenfeld

Күн бұрын

Пікірлер: 133
@umairramay8041
@umairramay8041 4 жыл бұрын
Please make a video about multi user login and sign up. And protecting different routes from different user types.
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
That's a great idea! Thanks for the suggestion!
@clervilmilly8751
@clervilmilly8751 4 жыл бұрын
Thanks Daniel ! Icant wait for that video
@paulocarsten9216
@paulocarsten9216 3 жыл бұрын
Am still waiting for thais
@Filmmshorts
@Filmmshorts 3 жыл бұрын
@@DanielFeldroy just subbed. Would be super interested in this topic as well and thank you for all your help. Loved django crash course
@giomsc
@giomsc 3 жыл бұрын
still waiting too
@georgesmith3022
@georgesmith3022 3 жыл бұрын
This video is a pure gold. Please make more videos for multiple user types
@the_street_coder4433
@the_street_coder4433 2 жыл бұрын
great tutorial Sir, I have been seated here wondering why you are using type as a field when type is a python built in function, you will be breaking the naming convention and overwritting the built in `type` function.
@xamifour6850
@xamifour6850 2 жыл бұрын
Fantastic! you speak clear and moderate for beginners to understand. Kindly come out with video to explain multiple user types, that allow user to be buyer or seller, or both. Thanks, and regards to Uma.
@melissatamplin
@melissatamplin 4 жыл бұрын
Thanks so much - and great intro by Audrey :D This is great content, I will definitely come back to see what other surprises Django has for me. Your book is great too btw :)
@djtoon8412
@djtoon8412 Жыл бұрын
It s a long ago but it is still worth in 2023.Please make a video on how to handle Multiple User types for a single user as you insited in last part of this video.
@amtawfiq
@amtawfiq 3 жыл бұрын
I've been looking for this for days. Thank you so much.
@lionelmuskwe
@lionelmuskwe 2 жыл бұрын
Thank you so so much. I subbed straight away. This was lucid and concise
@fabricejaouen4252
@fabricejaouen4252 3 жыл бұрын
Thank you very much: you have such an attractive pedagogy ! What I just miss is how to set permissions with your approach, however one of the very best videos on Django I've ever watched. I'm enthousiastic.
@mohsenhassani495
@mohsenhassani495 2 жыл бұрын
Thank you Daniel, both for this video and Multiple user types video
@rupeshchaulagain9299
@rupeshchaulagain9299 2 жыл бұрын
I don't why why but the intro music made me hit the like button instantly.
@abhishektayal480
@abhishektayal480 2 жыл бұрын
Thank you so much sir. I had a hard time understanding proxy models. Now I have a clear idea about them. Great explanation.
@ezekielminja5713
@ezekielminja5713 Жыл бұрын
Thank you so much...can you also make a video for multiple users as you suggested, i d really appreciate it
@remy8587
@remy8587 4 жыл бұрын
"type" is reserved in python that is why it is highlighted differently than "name" for example. Many people advice against using that, do you think it's not important?
@michaelhays
@michaelhays 4 жыл бұрын
It should be fine, see this answer: stackoverflow.com/a/10516154/3414529 And also the most upvoted comment on that answer: "Django creates a field named id and id() is a Python build-in function. Nobody confuses the two."
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
Because it's an attribute it's okay. If it were a function or variable name at the root scope it would be a problem.
@mosalam208
@mosalam208 3 жыл бұрын
please upload a video about the multiple user types using this same method and if possible how to connect them in a permission , thanks alot
@IqbalArain-io3du
@IqbalArain-io3du 6 ай бұрын
Thanks Seniore :) You are such a lovely person.
@bentwite3093
@bentwite3093 4 жыл бұрын
Thanks for this helpful video :) Can you please make a tutorial that talks about multiple type choices?
@wadleo
@wadleo 4 жыл бұрын
Awesome video sir
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
Much appreciated? How are you doingv these days?
@wadleo
@wadleo 4 жыл бұрын
@@DanielFeldroy I'm doing great sir
@tyrisnolam
@tyrisnolam 3 жыл бұрын
hi! I'd love to learn more about the implementation using ArrayField. Great video, very clear explanations, thank you! subscribed
@abdullahsifat9156
@abdullahsifat9156 4 жыл бұрын
I used proxy models for multiple user types... I've seen people always complicates like you've said in the earlier phase of video
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
Great minds think alike!
@ohidotg
@ohidotg 4 жыл бұрын
Hi Daniel, thank you so much for this.
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
Glad you like it! Your channel looks good!
@gerryfrank1786
@gerryfrank1786 3 жыл бұрын
Please make a video implementing multi login and signup.
@djangodeveloper2973
@djangodeveloper2973 4 жыл бұрын
OH MAN YOU'RE AMAZING. BE BLESSED.
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
Thank you! You too!
@Apoorvpandey
@Apoorvpandey 3 ай бұрын
How to add spy and driver specific data fields? For example I want SPY to have a mission = charField and driver to have a rating = integerField , these fields should not be there in User table
@eduardolucas391
@eduardolucas391 4 жыл бұрын
Brilliant! Well done and keep up this wonderful work.
@CaseyFahey
@CaseyFahey 8 ай бұрын
Just what i needed, thank you!
@alaatahakhoja6784
@alaatahakhoja6784 3 жыл бұрын
Very useful and elaborative. THANK YOU.
@Sharmazan
@Sharmazan 3 жыл бұрын
Thanks a lot for the explanation. It's crystal clear now!!!
@meuhmeuhmeuhify
@meuhmeuhmeuhify 4 жыл бұрын
Hey. Thanks for your work and your videos ! I've bought almost all of your Django books and happy to see you streaming now. If I would have done this before, i would probably have used an Abstract user Model and inherits from it. Would a Proxy model be the best choice if all the children models have the same attributes ? Should I switch to an abstract parent model if my children have different attributes ? Thanks and keep the good work.
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
If all the types have the same data, use Proxy models. If there's a difference in data, use OneToOne model relations. I've got a follow up video coming out later this week that will explain how. :-)
@konakziyaemre
@konakziyaemre 2 жыл бұрын
Loved your videos. Can you also do a video about how should be a product and variant models in Django. I’m struggling doing it because a variant should take a dynamic attributes and values. Which means user should be able to add a attribute by himself such as color or size and also user also should be able to add values to these attributes such as small, medium or black, blue. I really don’t know how to do it and I believe you definitely have an idea.
@bazwa6a
@bazwa6a Жыл бұрын
very valiable info.. thanks
@joshuahadap2373
@joshuahadap2373 3 жыл бұрын
Thank you so much, perfect for my capstone.
@mohhammadmohhammadi5848
@mohhammadmohhammadi5848 3 жыл бұрын
I laughed a lot and was happy. Thank you, man
@phoexer
@phoexer 4 жыл бұрын
Be grateful you weren't stuck in an awkward position like mid-fall or making an "expression".
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
Ha ha ha!
@thomas-sinkala
@thomas-sinkala 4 жыл бұрын
New to Django and building events with admin(the user who creates the events) and participants. Any idea how to structure the Model. Any user can be an admin if they created the event or a participant if they were invited to join.
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
class Event(models.Model): admins = models.ManyToMany(settings.AUTH_USER_MODEL, related_name="admins") attendees = models.ManyToMany(settings.AUTH_USER_MODEL, related_name="attendees") That's a straight-forward approach that with some debugging of my pseudocode should workl. I don't believe you have two user types, rather two different ways for people to participate in an event. Does that help?
@thomas-sinkala
@thomas-sinkala 4 жыл бұрын
@@DanielFeldroy Thank you very much Daniel. You're a lifesaver
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
@@thomas-sinkala I'm happy I could help!
@nimda2sdfsdfsd
@nimda2sdfsdfsd 2 жыл бұрын
Great Video, Clear talk, fantastic explanation. Also put a video on Django built in Groups, Another question is if we have groups, cant we achieve with groups whatever you have done with proxy models.
@inselmanu
@inselmanu 2 жыл бұрын
This i want to ask, too
@abhishektayal480
@abhishektayal480 2 жыл бұрын
We can but we won't be able to user different methods like 'whisper' and 'accelerate' for different users. Proxy models are used to define different characteristics from a single model without created a new table in db.
@thegrowers420
@thegrowers420 4 жыл бұрын
How bad would it be to just use bool and char fields to differentiate between users and their permissions? Thanks for sharing your knowledge by the way, I'm self taught and it hasn't been easy to figure out the best way to do things. Really need to read your book
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
That works, but more fields means more stuff to remember. I like keeping things simple and with just one field. Either a choice, ForeignKey, or ManyToMany field. That's arguably more normalized too.
@thegrowers420
@thegrowers420 4 жыл бұрын
@@DanielFeldroy thanks for the reply. I was worried I was just being stupid by doing that lol. I worry that my code is sloppy or just plain crappy and I won't know the verdict until someone tells me how my code is, I code with scalability, other programmers and future me in mind but I can't know if I'm doing it the right way lol. Thanks again for imparting your knowledge!
@phiberjenz
@phiberjenz 4 жыл бұрын
Hey Daniel, Thank you for this enlightening video! Would it be straight-forward to apply the same concept of proxy models but using an ArrayField in order for a user to have multiple types? Any pitfalls to know about? Would love to see a video about that as well.
@namwanzaronald9436
@namwanzaronald9436 Жыл бұрын
Learnt something very interesting to use in my project, thanks for the wonderful presentation. However, I have one question to ask here, let's say under Spy in the User model we have got other roles eg writer, viewer, commentor etc [list of other roles] - can this be achieved just like we created a whisper method ? , how would the spy class that inherits from the User class look like? Thanks.
@natanfelipedefreitassouza870
@natanfelipedefreitassouza870 3 жыл бұрын
Thank you! This tutorial is awesome.
@ankitkumar-mv9bw
@ankitkumar-mv9bw 3 жыл бұрын
Hey, I'm getting ValueError: Cannot force both insert and updating in model saving.
@Snowflake01210
@Snowflake01210 3 жыл бұрын
Hello, Thank you for your good video tutorials. Can you create a video tutorial on a School Management System's user types (Admin, Teacher, Student, Parent which they will have different fields) with different access permissions and views and dashboards.
@IqbalArain-io3du
@IqbalArain-io3du 6 ай бұрын
I am working this exact same situation, where I need Teacher, Admins, Students and Parents. 4 models
@johnrperry5897
@johnrperry5897 2 жыл бұрын
I'm halfway through the video so I'm sorry if you mention this in the second half, but what's the difference between setting the `abstract` parameter to True (in class Meta) vs setting the `proxy` parameter to True?
@bixber4431
@bixber4431 5 ай бұрын
How I make additional fields for any type of User? It need me for Online School with profiles of Users.
@sauravadhikari2285
@sauravadhikari2285 3 жыл бұрын
Great Video man, thanks !!
@agustinsabas4439
@agustinsabas4439 Жыл бұрын
Hi! I have a problem in my code.. Django doesn't send the email activation when i create a user with proxy model. Do you know why?? Help me 🙏 Thanks for this videos!!
@whichdude420
@whichdude420 4 жыл бұрын
Interesting way to implement multi user into a system. Thanks for sharing! Do you mind making a tutorial on how to implement push notification with django rest framework? Thanks in advance..
@SaRah-nx7rj
@SaRah-nx7rj 4 ай бұрын
Thank you so much .
@FabioCaritasBarrionuevodaLuz
@FabioCaritasBarrionuevodaLuz 4 жыл бұрын
Good work. Thanks
@slawikus1982
@slawikus1982 3 жыл бұрын
I wonder how one can use this approach to actually log in users of different type and get them info self.request.user - because by default it'll log in using the base class User, so it will not be possible to call "more" method of the child classes
@skumpuntele8941
@skumpuntele8941 4 жыл бұрын
What if different user types have some different attributes? What would be the best approach in that scenario?
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
I'll be recording that exact scenario in my live stream at twitch.tv/danielfeldroy. I'll take the recording of that and post it here on my channel later this week. :-)
@django3861
@django3861 3 жыл бұрын
@@DanielFeldroy Thank you so much
@TheRedEnt
@TheRedEnt 3 жыл бұрын
Hi Daniel Feldroy you are just awesome your tutorials are amazing. Daniel can you make a video like amazon has two type of users one Customer and another Seller how we can differentiate them both have the same User Model for authentication but signup process and permissions will be different same like amazon. Please make it if you have time.
@Julio-cz9cg
@Julio-cz9cg 3 жыл бұрын
Does this approach work to create users such as a SPY (and their custom fields) with a single POST request? Instead of first a request for User and then a request for Spy? I'm using DRF.
@akashdamle3731
@akashdamle3731 3 жыл бұрын
Danny, I'm confused about this. I see a subclass to AbstractUser but doesn't it imply that there are authentication fields built-in i.e username, password with their defaults set, (also the clumsy first_name, last_name) right? the way these models are created I don't see you providing either username/password and create user records, or maybe it is only a requirement for using Django admin? and what about making instances at runtime.. do I need entirely different forms or model forms that can adapt. I'm curious will try this and comment back
@bitchain
@bitchain 3 жыл бұрын
Stumbled across an issue with saving a user in Admin because normalize_email was not a method which is expected on an AbstractUser subclass - solved by e.g. SpyManager extending from django.contrib.auth.models import UserManager
@pranavichandra6439
@pranavichandra6439 3 жыл бұрын
It's a great video hoping to see more in the future :) I am new to Django and still trying to wrap my head around it. here are a few queries I got type change in database could swap their roles completely, is it a good thing to keep different users in same table? In my case I have Customers, B2B Users, Admin user types. Is it possible to achieve different authentication mechanisms with the proxy approach eg: login with email for SPY, login with registered id for Driver? SPY, Driver can both login as Admin since both are auth.User, How can we stop it?
@zakchips
@zakchips 4 жыл бұрын
Can I use this approach if spy can be one time a spy, and another time a driver. and visa versa another time. the same for a driver. Thanks in advance.
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
You mean have a ManyToMany relationship? Absolutely!
@surajthapafc
@surajthapafc 4 жыл бұрын
Thanks sir
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
You 're welcome! Tell me what I can do better!
@arields27
@arields27 4 жыл бұрын
With handlers declared that way, the StackedInline in the admin throws an error. How can I fix that? Thanks.
@infinitx1330
@infinitx1330 3 жыл бұрын
Is it possible to create a custom user that authenticates only using a password ( and doesn't require a second field like email etc) ??
@amircodes
@amircodes 4 жыл бұрын
Thanks Daniel, It was great. Can you please offer me a book/resource to understand django in depth?
@deobyeol8083
@deobyeol8083 3 жыл бұрын
Can I add fields in Spy and Driver model?
@lessentiel221
@lessentiel221 2 жыл бұрын
Example with AbstractBaseUser
@RiskyCoder
@RiskyCoder 4 жыл бұрын
Great job. when 2nd part is coming?
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
I hope to roll it out this weekend.
@RiskyCoder
@RiskyCoder 4 жыл бұрын
@@DanielFeldroy I see that GitHub repository has been updated but still did not get any video on it. When we will have it ? I have recommended someone this video to manage multiple user types in Django and they are waiting for the 2nd part.
@anonymoustroll8062
@anonymoustroll8062 4 жыл бұрын
Hello sir? I know python 3 for almost half a year I just want to try some web frameworks so.. two scoops with Django 3 was good for beginner like me? If it is not good for beginner. Kindly send some links for Django book for beginner.
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
Try this tutorial: www.feldroy.com/products/django-crash-course
@danielcardenas9004
@danielcardenas9004 4 жыл бұрын
Hi Daniel, I have been following this tutorial, first of all, very nice job, second when I try to create a Driver from the admin panel I get the following error: 'DriverManager' object has no attribute 'normalize_email' It is very odd and haven't been able to reproduce it, I'd love some insight (I literally took the github source code and paste it on my models to fully understand the workflow but I got that error) Thanks
@quizy101
@quizy101 4 жыл бұрын
Same here, whenever I try to create from the admin site I get the "object has no attribute 'normalize_email'". Anyone else know how to work around this?
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
Weird, I don't get that. Can either of you share your repo?
@quizy101
@quizy101 4 жыл бұрын
@@DanielFeldroy I figured it out, instead of the manager inheriting `models.Manager` I changed it to be `class DriverManager(BaseUserManager)` and that cleared it right up! Thank you for the videos!
@vincentroye
@vincentroye Жыл бұрын
Hi Daniel, What would be the easiest way to allow a user to be a spy and a driver? or eventually 10 different user types?
@maxkeogh
@maxkeogh 8 ай бұрын
I too would like to know how best to implement multiple user types per user. In this video you mentioned using an array. Are there any clues to do this in Two Scoops? If you don't have time to do a separate video do you know of good resources that explain this? Cheers.
@caringangels12
@caringangels12 3 жыл бұрын
With this implementation can I display different forms for different user types ?
@LiaAdzumi
@LiaAdzumi 3 жыл бұрын
Hi, Thanks for showing multi users. But please put it in real world simple app. Thanks again. BR, Nyoman
@karelantonioverdeciaortiz5618
@karelantonioverdeciaortiz5618 4 жыл бұрын
Hi, what software did you use to record this lesson?
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
Streamlabs OBS
@hassanbutt352
@hassanbutt352 3 жыл бұрын
First time KZbin Recommended something Usefull......
@jhoniemusic
@jhoniemusic 3 жыл бұрын
may i know what is the meaning of _('Type"). thank you
@bikerboy582
@bikerboy582 3 жыл бұрын
translation
@roficakep
@roficakep 4 жыл бұрын
Please make a video from scratch, step by step django project using multi user login with custom user model. thanks.
@visheshmangla2650
@visheshmangla2650 3 жыл бұрын
what is the use of `not self.pk`?
@ThukuWakogi
@ThukuWakogi 3 жыл бұрын
so, is shell_plus inbuilt in django or one makes it
4 жыл бұрын
Powerful!
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
Glad you liked it!
@rafaeldiasmartins4369
@rafaeldiasmartins4369 Жыл бұрын
Yeah, boy! Look, it great, but if the user is a driver and a spy? Could you give a hand with taht?
@jhoniemusic
@jhoniemusic 3 жыл бұрын
raise TypeError("%s cannot proxy the swapped model '%s'." % (name, base_meta.swapped)) TypeError: Rider cannot proxy the swapped model 'Accounts.Account'.
@jhoniemusic
@jhoniemusic 3 жыл бұрын
don't worry about this. i got it. its my mistake
@nischalstha9
@nischalstha9 4 жыл бұрын
Great!!
@kimkimathi2312
@kimkimathi2312 3 жыл бұрын
User has no attribute name 'Types ' what might be the problem with your code
@kimkimathi2312
@kimkimathi2312 3 жыл бұрын
This is after I implement the code by AbstractBaseUser
@mmkmmk9945
@mmkmmk9945 4 жыл бұрын
create job
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
Thank you!
@thatsenoughdixit
@thatsenoughdixit 3 жыл бұрын
I just want admin and user 🤣
@dennielluissadian5026
@dennielluissadian5026 4 жыл бұрын
Hi? Who is she? What's her nationality?
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
That's my wife, Audrey Feldroy. She is also a programmer, writer, mother, went to MIT, and is very smart. If you ever use Cookiecutter or djangopackages.org you can thank her. 🙂
@DanielFeldroy
@DanielFeldroy 4 жыл бұрын
She is Filipina/Indian.
@dennielluissadian5026
@dennielluissadian5026 4 жыл бұрын
@@DanielFeldroy OMG! I'm a Filipino! Both of you are so cool!
@Demtri-mp1oc
@Demtri-mp1oc 9 ай бұрын
Lets gather here spies. :)
@siyapandey8799
@siyapandey8799 2 жыл бұрын
Thank you so much
Multiple User Types With Custom Data Fields | Django
7:36
Daniel Roy Greenfeld
Рет қаралды 19 М.
So Cute 🥰
00:17
dednahype
Рет қаралды 43 МЛН
Author reacts to Bad and Great Books: Django 3 By Example
5:15
Daniel Roy Greenfeld
Рет қаралды 7 М.
USA Nice Olympiad Exponential Equation | Solve for X
6:38
Learncommunolizer
Рет қаралды 10 М.
How to get a job as a Python developer in 2020
22:39
Daniel Roy Greenfeld
Рет қаралды 11 М.
Custom User Model with email login (DJANGO)
39:21
CodingWithMitch
Рет қаралды 46 М.
How to extend the User Model in Django with AbstractUser
13:55
Live Discussion with Sebastián Ramírez (Tiangelo/FastAPI)
1:03:25
Daniel Roy Greenfeld
Рет қаралды 3,6 М.
Understanding Django Model Relationships
25:56
Pretty Printed
Рет қаралды 94 М.
Django Multiuser Registration and Login based on Role
19:06
Mr. Django
Рет қаралды 57 М.