From b8824b3f46861a2d49b38ec2c6520e2008524382 Mon Sep 17 00:00:00 2001 From: Tomislav R Date: Mon, 7 Mar 2016 18:39:24 +0100 Subject: [PATCH] fixed CustomUser --- dynamicweb/settings/base.py | 48 ++++++++++++++++++------------------- membership/models.py | 5 ++++ 2 files changed, 29 insertions(+), 24 deletions(-) diff --git a/dynamicweb/settings/base.py b/dynamicweb/settings/base.py index 1cf61ae0..f57c9794 100644 --- a/dynamicweb/settings/base.py +++ b/dynamicweb/settings/base.py @@ -48,6 +48,9 @@ SECRET_KEY = env('DJANGO_SECRET_KEY') INSTALLED_APPS = ( 'membership', 'filer', + 'cms', # django CMS itself + 'cmsplugin_filer_image', + 'djangocms_blog', 'djangocms_admin_style', 'django.contrib.admin', 'django.contrib.auth', @@ -56,7 +59,6 @@ INSTALLED_APPS = ( 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.sites', - 'cms', # django CMS itself 'treebeard', # utilities for implementing a tree 'menus', # helper for model independent hierarchical website navigation 'sekizai', # for javascript and css management @@ -70,7 +72,6 @@ INSTALLED_APPS = ( 'djangocms_page_meta', # django-filer 'cmsplugin_filer_file', - 'cmsplugin_filer_image', 'cmsplugin_filer_folder', 'cmsplugin_filer_link', 'cmsplugin_filer_teaser', @@ -94,7 +95,6 @@ INSTALLED_APPS = ( 'ungleich', 'hosting', 'digitalglarus', - 'djangocms_blog', ) MIDDLEWARE_CLASSES = ( @@ -268,28 +268,28 @@ META_SITE_PROTOCOL = 'http' META_USE_SITES = True MIGRATION_MODULES = { - 'cms': 'cms.migrations', + # 'cms': 'cms.migrations', # 'filer': 'filer.migrations_django', - 'menus': 'menus.migrations_django', - 'djangocms_flash': 'djangocms_flash.migrations_django', - 'djangocms_googlemap': 'djangocms_googlemap.migrations_django', - 'djangocms_inherit': 'djangocms_inherit.migrations_django', - 'djangocms_link': 'djangocms_link.migrations_django', - 'djangocms_snippet': 'djangocms_snippet.migrations_django', - 'djangocms_teaser': 'djangocms_teaser.migrations_django', - 'djangocms_column': 'djangocms_column.migrations_django', - 'djangocms_flash': 'djangocms_flash.migrations_django', - 'djangocms_googlemap': 'djangocms_googlemap.migrations_django', - 'djangocms_inherit': 'djangocms_inherit.migrations_django', - 'djangocms_style': 'djangocms_style.migrations_django', + # 'menus': 'menus.migrations_django', + # 'djangocms_flash': 'djangocms_flash.migrations_django', + # 'djangocms_googlemap': 'djangocms_googlemap.migrations_django', + # 'djangocms_inherit': 'djangocms_inherit.migrations_django', + # 'djangocms_link': 'djangocms_link.migrations_django', + # 'djangocms_snippet': 'djangocms_snippet.migrations_django', + # 'djangocms_teaser': 'djangocms_teaser.migrations_django', + # 'djangocms_column': 'djangocms_column.migrations_django', + # 'djangocms_flash': 'djangocms_flash.migrations_django', + # 'djangocms_googlemap': 'djangocms_googlemap.migrations_django', + # 'djangocms_inherit': 'djangocms_inherit.migrations_django', + # 'djangocms_style': 'djangocms_style.migrations_django', # 'cmsplugin_filer_image': 'cmsplugin_filer_image.migrations_django', - 'cmsplugin_filer_file': 'cmsplugin_filer_file.migrations_django', - 'cmsplugin_filer_folder': 'cmsplugin_filer_folder.migrations_django', - 'cmsplugin_filer_link': 'cmsplugin_filer_link.migrations_django', - 'cmsplugin_filer_teaser': 'cmsplugin_filer_teaser.migrations_django', - 'cmsplugin_filer_utils': 'cmsplugin_filer_utils.migrations_django', - 'cmsplugin_filer_video': 'cmsplugin_filer_video.migrations_django', - 'djangocms_text_ckeditor': 'djangocms_text_ckeditor.migrations', + # 'cmsplugin_filer_file': 'cmsplugin_filer_file.migrations_django', + # 'cmsplugin_filer_folder': 'cmsplugin_filer_folder.migrations_django', + # 'cmsplugin_filer_link': 'cmsplugin_filer_link.migrations_django', + # 'cmsplugin_filer_teaser': 'cmsplugin_filer_teaser.migrations_django', + # 'cmsplugin_filer_utils': 'cmsplugin_filer_utils.migrations_django', + # 'cmsplugin_filer_video': 'cmsplugin_filer_video.migrations_django', + # 'djangocms_text_ckeditor': 'djangocms_text_ckeditor.migrations', } STATICFILES_FINDERS = ( @@ -407,4 +407,4 @@ META_INCLUDE_KEYWORDS = ["ungleich", "hosting", "switzerland", META_USE_SITES = True PARLER_LANGUAGES = {1: ({'code': 'en-us'}, {'code': 'de'},)} -# AUTH_USER_MODEL = 'membership.CustomUser' +AUTH_USER_MODEL = 'membership.CustomUser' diff --git a/membership/models.py b/membership/models.py index 3fd46cb9..a761be7b 100644 --- a/membership/models.py +++ b/membership/models.py @@ -51,6 +51,7 @@ class CustomUser(AbstractBaseUser): objects = MyUserManager() USERNAME_FIELD = "email" + REQUIRED_FIELDS = ['name','password'] @classmethod def register(cls, name, password, email): @@ -74,6 +75,10 @@ class CustomUser(AbstractBaseUser): user.validated = 1 return True return False + def is_superuser(self): + return True + def is_admin(self): + return True def get_full_name(self): # The user is identified by their email address