Permalink
Browse files

Merged changes from PR

  • Loading branch information...
2 parents e667c75 + 0a262f5 commit 3954fbbda3beaa757d1f9270526d17a4a26a336d @tanderegg tanderegg committed Feb 27, 2014
Showing with 16 additions and 10 deletions.
  1. +11 −9 cms/models/permissionmodels.py
  2. +5 −1 cms/test_utils/project/emailuserapp/admin.py
@@ -17,16 +17,18 @@
# To avoid circular dependencies, don't use cms.compat.get_user_model, and
# don't depend on the app registry, to get the custom user model if used
if is_user_swapped:
- user_app_name = user_model_label.split('.')[0]
- user_model_name = user_model_label.split('.')[1]
+ user_app_name, user_model_name = user_model_label.rsplit('.', 1)
+ User = None
for app in settings.INSTALLED_APPS:
- if user_app_name in app:
- try:
- User = getattr(importlib.import_module(app + ".models"), user_model_name)
- except AttributeError:
- raise ImproperlyConfigured('''
- DjangoCMS requires the name of custom user models to be "User"
- ''')
+ if app.endswith(user_app_name):
+ user_app_models = importlib.import_module(app + ".models")
+ User = getattr(user_app_models, user_model_name)
+ break
+ if User is None:
+ raise ImproperlyConfigured(
+ "You have defined a custom user model %s, but the app %s is not "
+ "in settings.INSTALLED_APPS" % (user_model_label, user_app_name)
+ )
else:
from django.contrib.auth.models import User
@@ -37,4 +37,8 @@ class UserAdmin(OriginalUserAdmin):
ordering = ('last_name', 'first_name', 'email')
# Now register the emailuser admin
-admin.site.register(EmailUser, UserAdmin)
+<<<<<<< HEAD
+admin.site.register(EmailUser, UserAdmin)
+=======
+admin.site.register(User, UserAdmin)
+>>>>>>> 0a262f538dc259bd608314d235f2c2d81f67ec42

0 comments on commit 3954fbb

Please sign in to comment.