1👍
At the moment, the recommended way is to create a Profile
model and link it to the User
model with a OneToOneField
or a ForeignKey
(depending on your requirements). Here’s a good tutorial on the topic.
The Django devs have repeatedly expressed their intent to make extending the User
model more straightforward, but AFAIK, no concrete design has been proposed, yet.
1👍
Adding a custom UserProfile
would be one way to go about this. UserProfile
can link to Country
and you can prevent users based on their UserProfile
. I found James Bennett’s article on extending the User model useful when I had a similar requirement.
It is generally not a good idea to patch auth
(or other built in) classes. Custom patches can become a pain to maintain and keep up to date.
- [Answered ]-What is type is Site.objects.get_current() in django ; it returns <SIte: example.com>. I need to serialize it
- [Answered ]-Django executing backward relation query occurred a maximum recursion depth exceeded error when I use Manager
- [Answered ]-Localizing CharFields and ModelForms with choices in Django