5👍
✅
There is very simple solution. Just need to register your custom user before importing CMSPlugin. Example:
from django.db import models from django.contrib.auth import models as auth_models from django.contrib.auth.models import AbstractUser class User(AbstractUser): telephone = models.CharField(max_length=100) email = models.CharField(max_length=100) auth_models.User = User from cms.models import CMSPlugin
1👍
Here is my summary of the further discussion at https://github.com/divio/django-cms/issues/1798.
There are four potential options:
- If you need your custom user model to have a name other than User, you’ll need to wait.
- 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. - 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.)
- 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!
- [Django]-Monitoring django postgres connections
- [Django]-How to change model class name without losing data?
- [Django]-Django – why can't I access dynamically-generated attributes in classes in my models.py from admin.py?
Source:stackexchange.com