Extending User object in Django: User model inheritance or use UserProfile?

前端 未结 2 1674
旧时难觅i
旧时难觅i 2021-02-05 11:36

To extend the User object with custom fields, the Django docs recommend using UserProfiles. However, according to this answer to a question about this from a year or so back:

2条回答
  •  你的背包
    2021-02-05 12:05

    Here is what James Bennett says in this blog entry about model inheritance:

    I’d wager that probably 90% or more of the things people say they want to do with subclasses could be better accomplished by instead defining a related model and linking it back with a unique foreign key.

    So I believe the best way to go is still to use an external app, such as some components of Pinax, or the django-profiles app (originally from the same James Bennett).

提交回复
热议问题