Django 1.3, extending to User auth system, User Profiling or Subclassing?

混江龙づ霸主 提交于 2020-01-06 13:52:38

问题


Subclassing: http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/

User Profiling: https://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users

Which one is more efficient and less of a hassle?

And

Which way should I go if I plan to scale big?


回答1:


Don't use subclassing unless you're prepared to 1) write your own auth backend, and 2) forgo ever using a different auth backend.




回答2:


It seems to makes sense to have the simplest model possible for authentication and then all other connected data in the Profile.

Generally I would use the UserProfile class for reasons such as Ignacio says but also because after a bout of normalisation, I normally find the data wouldn't belong in the User table.



来源:https://stackoverflow.com/questions/6351521/django-1-3-extending-to-user-auth-system-user-profiling-or-subclassing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!