-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
PageUserAdmin doesn't work with custom user model #3377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Override |
Unfortunately that's not enough. It crashes during validating the models, which happens on import of |
So, maybe this one https://docs.djangoproject.com/en/1.6/topics/auth/customizing/#django.contrib.auth.models.CustomUser.REQUIRED_FIELDS together with my first advice. |
@mmarzantowicz so is your advice that we should submit a pull request to Django-CMS to change the list_display to include the REQUIRED_FIELDS instead of hard-coding the list of fields? Or did I misunderstand? |
This might be the best you can do. Quick fix might be not to use |
OK, here's a pull request. I wasn't able yet to make a single test use a custom user model. The only way I could trigger a failure was to run the tests like this:
I added such a test to the Travis configuration in 2eb9e84. There are still problems with PageUserAdmin if your user model lacks some fields. Users will have to subclass it and change the fieldsets to include the fields that actually work, but at least they can import it now, so they can actually subclass it. |
mmmh strange test failures.... |
Test failures only on the custom user model build? I get test failures on trunk when I run tests locally even without my changes. Have you thought about using tox? |
no all tests fail.... locally we run it with python develop.py test |
yes we had a look at many different testing architectures over the year... PR with working implementation always welcome :) |
they fail on travis: https://travis-ci.org/divio/django-cms/builds/32526618 |
More explanation coming soon once this has run.
Try the new Travis CI beta build env
@qris: I'd like to merge this in 3.0.6 but current PR has too many extraneous commits. |
Changing plugin delete template to fix error with django 1.7
Move to request.path_info to be more compatible
Fixed initial migration for Page.template field choices
Added failing test
Fix resetting override url when editing basic settings
On single file modules (without __init__.py) `./manage.py cms check` fails with AttributeError: 'module' object has no attribute '__path__' How to reproduce: 1. pip install feedparser 2. Add in settings.py: INSTALLED_APPS = INSTALLED_APPS + ('feedparser', ) 3. Run ./manage.py cms check
…ntranslated Fix hide untranslated
Reset maximize classes when the drag handle is moved
…gration Move remaining choices to be determined dynamically in the migrations
Fix fails on not packaged single file modules
Don't crash at startup if the custom user model has no first_name and last_name fields. The PageUserAdmin still won't actually work, so you'll have to subclass it and change the fieldsets to include the fields that actually work, but at least you can import it now.
Allows us to test whether PageUserAdmin works or not.
This conceals the original error that you actually want to fix.
1c1be95
to
817f4ef
Compare
@yakky done |
We have a custom user model that has a
full_name
field instead offirst_name
andlast_name
.When we set
CMS_PERMISSION = True
, the CMS breaks with this error:ImproperlyConfigured: PageUserAdmin.list_display[1], 'first_name' is not a callable or an attribute of 'PageUserAdmin' or found in the model 'PageUser'.
PageUserAdmin hard-codes the field list, which breaks it for us:
What should we do here? Unregister
PageUserAdmin
and replace it with a custom one?