I have a sensible problem:
I want to create a user profile for my page, which That many characteristics but since I am new to the user model of the athens user, I do not know if I can increase that model with the new features that I set for the user profile. Like address, age, ...
If not, why is the user model? Is it for auth purposes only? How do I handle and differentiate these two user models?
Sample case:
The user wants to log in, I check permission with auth user model and set some relation between the user model of DJ and mine? I'm just confused here
I will try to explain in the perspective of pre-django 1.5
The Diego's athletic model provides a set of "convenience" methods such as login, logout, password reset, etc. for you that you work without any work. This is a very common scenario in order to be more field - so one method will be to create a user productual model, which is either derived from Example: Import django.contrib.auth.models from or In this way, you can use all the features and build on it. It has changed a bit in the demo -1.5, which gives custom fields to users, a from the django auth user model, or
OneToOne Relationships on the same way, you do not need to re-implement some of the features already implemented. In addition, such packages contain
groups and
permissions models that add a full layer of functionality in case of user permissions.
User class MyCustomProfile (user): # Delete all properties of the default model # Model model # Additional models Import django.contrib.auth.models user class MyCustomProfile (models.Model) from
: user = models.OneToOneField (user) # Additional model here
UserProfile model at the top of the already existing
user Creates Model
No comments:
Post a Comment