django 1.5 extend the default User model or substitute it

后端 未结 2 1314
谎友^
谎友^ 2021-01-14 09:16

Env: Django 1.5.1 + Django CMS 2.4.1 + Zinnia latest + my custom apps + custom Django CMS plugin

Basically I can extend the default Django (1.5.X) User model like D

2条回答
  •  清歌不尽
    2021-01-14 09:38

    Here is my summary of the further discussion at https://github.com/divio/django-cms/issues/1798.

    There are four potential options:

    1. If you need your custom user model to have a name other than User, you'll need to wait.
    2. You can call the custom user model User - though when I tried this, I got errors about clashes with related m2m fields. There are some further details on the above link which may help resolve this.
    3. Django 1.5 still lets you use user profiles. So if you are ok with using a deprecated feature, you can still use Django-CMS 2.4 and Django 1.5 with user profiles instead of a custom user model. (I misread the Django docs here and thought user profiles were not supported in Django 1.5.)
    4. You can often get away without either a user profile or a custom user model - they are best used to add data specifically for user authentication. Instead, you can use another model with a one-to-one relationship to User, and use the reverse relationship to access it.

    For my case, I am going to go with #3 in the short-run and #4 in the long-run.

    Hope that helps!

提交回复
热议问题