The right way to handle extra user data in Django?

I need to add a significant amount of additional properties for each user in my Django project. Some of these properties are simple CharFields, others are more complex ManyToManyFields. The problem for me is that in my search for ways to do this, I found two options: The user profile method explained in the documentation and the custom subclass method I see that it floats on the Internet.

They both look complicated, and I would rather not choose one to find out that I need to go back and switch to another method after several months of development, so I ask here. How is this the right way?

+3
source share
4 answers

I always did this in the traditional way, which means user profile, because it was suggested in the documents, but it is not a very clear and elegant solution. You should always handle the fact that the user does not have a profile that I do not really like. In the next project, I would like to use subclasses, and if it were in a stable version of Django, I would push colleagues in my company to try this. It seems a lot more natural.

, proile. , . - - .

+2

, , - .

0

: , . , , , . , , Client save() . , . , , . .

. .

0

Like aldux, I prefer to create a split model and let the User model be untouched.

0
source

Source: https://habr.com/ru/post/1726195/


All Articles