diff --git a/portail_citoyen/admin.py b/portail_citoyen/admin.py index 827d46c..5383335 100644 --- a/portail_citoyen/admin.py +++ b/portail_citoyen/admin.py @@ -61,6 +61,8 @@ if settings.AUTH_USER_MODEL == 'portail_citoyen.Citoyen': return self.fieldsets + if models.Citoyen in admin.site._registry: + admin.site.unregister(models.Citoyen) admin.site.register(models.Citoyen, CitoyenAdmin) from django.contrib.auth.admin import GroupAdmin diff --git a/portail_citoyen/apps/auquotidien_plugin/static/auquotidien_plugin/js/categories.js b/portail_citoyen/apps/auquotidien_plugin/static/auquotidien_plugin/js/categories.js index e6f2da8..c0c4343 100644 --- a/portail_citoyen/apps/auquotidien_plugin/static/auquotidien_plugin/js/categories.js +++ b/portail_citoyen/apps/auquotidien_plugin/static/auquotidien_plugin/js/categories.js @@ -10,8 +10,6 @@ $(document).ready(function () { } $plugin.data('initialized', 1); - $titles.hide(); - if ($categories.length > 1) { if ($empty) { $categories.hide(); diff --git a/portail_citoyen/apps/msp/urls.py b/portail_citoyen/apps/msp/urls.py index b6eac8f..1557d78 100644 --- a/portail_citoyen/apps/msp/urls.py +++ b/portail_citoyen/apps/msp/urls.py @@ -1,6 +1,6 @@ from django.conf.urls import patterns, url -urlpatterns = patterns('msp.views', +urlpatterns = patterns('portail_citoyen.apps.msp.views', url(r'^login/$', 'login', name='msp-login'), url(r'^link/$', 'link', name='msp-link'), url(r'^login-or-link/$', 'login_or_link', name='msp-login-or-link'), diff --git a/portail_citoyen/cms_plugins.py b/portail_citoyen/cms_plugins.py index 40a32a7..f009706 100644 --- a/portail_citoyen/cms_plugins.py +++ b/portail_citoyen/cms_plugins.py @@ -8,7 +8,7 @@ from cms.plugin_pool import plugin_pool from cms.models.pluginmodel import CMSPlugin -from . import models, utils, app_settings +from . import utils, app_settings class FormPluginBase(CMSPluginBase): @@ -32,8 +32,9 @@ class FormPluginBase(CMSPluginBase): placeholder) if issubclass(form_class, ModelForm): if not hasattr(self, 'get_form_instance'): - raise ImproperlyConfigured('Your plugin class is missing a get_object method but use a ModelForm') - kwargs['instance'] = context['object'] = self.get_form_instance(request, context, instance, placeholder) + raise ImproperlyConfigured('Your plugin class is missing a get_form_instance method but use a ModelForm') + kwargs['instance'] = context['object'] = \ + self.get_form_instance(request, context, instance, placeholder) if utils.callable_has_arg(form_class.__init__, 'plugin_instance'): kwargs['plugin_instance'] = instance if utils.callable_has_arg(form_class.__init__, 'request'): diff --git a/portail_citoyen/dashboard.py b/portail_citoyen/dashboard.py index 4279bd2..05640f6 100644 --- a/portail_citoyen/dashboard.py +++ b/portail_citoyen/dashboard.py @@ -30,8 +30,8 @@ class CustomIndexDashboard(Dashboard): _('Contents'), models=( 'cms.models.pagemodel.Page', - 'data_source_plugin.models.DataSource', - 'feed_plugin.models.Feed', + 'portail_citoyen.apps.data_source_plugin.models.DataSource', + 'portail_citoyen.apps.feed_plugin.models.Feed', ), )) diff --git a/portail_citoyen/settings.py b/portail_citoyen/settings.py index dfd3907..b41c296 100644 --- a/portail_citoyen/settings.py +++ b/portail_citoyen/settings.py @@ -10,7 +10,8 @@ DEBUG_PROPAGATE_EXCEPTIONS = 'DEBUG_PROPAGATE_EXCEPTIONS' in os.environ USE_DEBUG_TOOLBAR = 'USE_DEBUG_TOOLBAR' in os.environ TEMPLATE_DEBUG = DEBUG -PROJECT_PATH = os.path.join(os.path.dirname(__file__)) +BASE_DIR = os.path.dirname(__file__) +PROJECT_PATH = os.path.join(BASE_DIR, '..') PROJECT_NAME = 'portail-citoyen' ADMINS = () @@ -26,7 +27,7 @@ MANAGERS = ADMINS DATABASES = { 'default': { 'ENGINE': os.environ.get('DATABASE_ENGINE', 'django.db.backends.sqlite3'), - 'NAME': os.environ.get('DATABASE_NAME', os.path.join(PROJECT_PATH, '..', PROJECT_NAME + '.db')), + 'NAME': os.environ.get('DATABASE_NAME', os.path.join(PROJECT_PATH, PROJECT_NAME + '.db')), 'USER': os.environ.get('DATABASE_USER', ''), 'PASSWORD': os.environ.get('DATABASE_PASSWORD', ''), 'HOST': os.environ.get('DATABASE_HOST', ''), @@ -57,9 +58,6 @@ MEDIA_URL = os.environ.get('MEDIA_URL', '/media/') PASSERELLE_URL = os.environ.get('PASSERELLE_URL', '') PASSERELLE_APIKEY = os.environ.get('PASSERELLE_APIKEY', '') -if 'STATICFILES_DIRS' in os.environ: - STATICFILES_DIRS = os.environ['STATICFILES_DIRS'].split(':') - TEMPLATE_LOADERS = ( 'django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader', @@ -79,6 +77,7 @@ TEMPLATE_CONTEXT_PROCESSORS = ( ) MIDDLEWARE_CLASSES = ( + 'entrouvert.djommon.middleware.VersionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.http.ConditionalGetMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', @@ -92,20 +91,29 @@ MIDDLEWARE_CLASSES = ( 'cms.middleware.page.CurrentPageMiddleware', 'cms.middleware.user.CurrentUserMiddleware', 'cms.middleware.toolbar.ToolbarMiddleware', - 'entrouvert.djommon.middleware.VersionMiddleware', ) PORTAIL_CITOYEN_FAVICON_URL = '' ROOT_URLCONF = 'portail_citoyen.urls' -TEMPLATE_DIRS = [os.path.join(PROJECT_PATH, 'templates')] -if os.environ.get('TEMPLATE_DIRS'): - TEMPLATE_DIRS = os.environ['TEMPLATE_DIRS'].split(':') + TEMPLATE_DIRS -else: - TEMPLATE_DIRS = ['/var/lib/%s/templates' % PROJECT_NAME] + TEMPLATE_DIRS +VAR_DIR = os.path.join('/var/lib/', PROJECT_NAME) -TEMPLATE_DIRS = tuple(TEMPLATE_DIRS) +TEMPLATE_DIRS = ( + os.path.join(VAR_DIR, 'templates'), + os.path.join(BASE_DIR, 'templates'), +) + +STATICFILES_DIRS = ( + os.path.join(VAR_DIR, 'extra-static'), + os.path.join(BASE_DIR, 'static'), +) + +if os.environ.get('TEMPLATE_DIRS'): + TEMPLATE_DIRS = tuple(os.environ['TEMPLATE_DIRS'].split(':')) + TEMPLATE_DIRS + +if os.environ.get('STATICFILES_DIRS'): + STATICFILES_DIRS = tuple(os.environ['STATICFILES_DIRS'].split(':')) + STATICFILES_DIRS INSTALLED_APPS = ( 'admin_tools', @@ -218,7 +226,7 @@ USE_DISCO_SERVICE = 'USE_DISCO_SERVICE' in os.environ ########################### # Only RSA private keys are currently supported -AUTH_FRONTENDS = ( 'authentic2.auth2_auth.backend.LoginPasswordBackend',) +AUTH_FRONTENDS = ( 'authentic2.auth_frontends.LoginPasswordBackend',) # expiration in seconds of authentication events. @@ -378,6 +386,9 @@ LOGGING = { } SOUTH_TESTS_MIGRATE = False +# Raven DSN +RAVEN_CONFIG_DSN = os.environ.get('RAVEN_CONFIG_DSN') + # Admin tools ADMIN_TOOLS_INDEX_DASHBOARD = 'portail_citoyen.dashboard.CustomIndexDashboard' ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'portail_citoyen.dashboard.CustomAppIndexDashboard' @@ -468,3 +479,23 @@ if IDP_OPENID: if IDP_CAS: INSTALLED_APPS += ('authentic2.idp.idp_cas',) +if RAVEN_CONFIG_DSN: + RAVEN_CONFIG = { + 'dsn': RAVEN_CONFIG_DSN, + } + INSTALLED_APPS += ('raven.contrib.django.raven_compat', ) + LOGGING['handlers']['sentry'] = { + 'level': 'ERROR', + 'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler', + } + LOGGING['loggers']['raven'] = { + 'level': 'DEBUG', + 'handlers': ['console'], + 'propagate': False, + } + LOGGING['loggers']['sentry.errors'] = { + 'level': 'DEBUG', + 'handlers': ['console'], + 'propagate': False, + } + LOGGING['loggers']['']['handlers'].append('sentry') diff --git a/portail_citoyen/templates/portail_citoyen/profile_form_plugin.html b/portail_citoyen/templates/portail_citoyen/profile_form_plugin.html index 20a6d95..72c909b 100644 --- a/portail_citoyen/templates/portail_citoyen/profile_form_plugin.html +++ b/portail_citoyen/templates/portail_citoyen/profile_form_plugin.html @@ -1,6 +1,10 @@ {% load i18n %}
+
+ +

{{ user.username }}

+

{{ user.email }}

diff --git a/portail_citoyen/urls.py b/portail_citoyen/urls.py index 0a3183c..549f00f 100644 --- a/portail_citoyen/urls.py +++ b/portail_citoyen/urls.py @@ -1,5 +1,4 @@ from django.conf.urls import patterns, include, url -from django.conf.urls.i18n import i18n_patterns from django.contrib import admin from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.conf import settings @@ -38,7 +37,7 @@ if settings.DEBUG: {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), ) -if 'msp' in settings.INSTALLED_APPS: +if 'portail_citoyen.apps.msp' in settings.INSTALLED_APPS: urlpatterns += patterns('', url('^msp/', include('portail_citoyen.apps.msp.urls')), ) @@ -50,7 +49,7 @@ if 'cms_ajax_text_plugin' in settings.INSTALLED_APPS: -urlpatterns += i18n_patterns('', +urlpatterns += patterns('', url(r'^', include('cms.urls')), ) diff --git a/requirements.txt b/requirements.txt index 5572b63..4a449eb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,7 @@ --allow-all-external --allow-unverified django-admin-tools -f https://repos.entrouvert.org/django-cms.git/ -django-cms +django-cms>=2.5.0,<3.0 -f https://repos.entrouvert.org/python-entrouvert.git/ python-entrouvert requests>=1.0.0 diff --git a/setup.py b/setup.py index 1100260..9f7596b 100755 --- a/setup.py +++ b/setup.py @@ -120,7 +120,7 @@ setup(name="portail_citoyen", 'django>=1.5.1,<1.6', 'authentic2>2.0.2', 'cmsplugin-text-wrapper>=0.5', - 'django-cms>2.4.1,<2.4.2', + 'django-cms>=2.5,<3.0', 'python-entrouvert', 'south>=0.8.4', 'django-cms-ajax-text-plugin',