Merge branch 'master' into wip/portail-entreprise

This commit is contained in:
Jérôme Schneider 2014-03-26 11:27:15 +01:00
commit e963ac7483
10 changed files with 61 additions and 26 deletions

View File

@ -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

View File

@ -10,8 +10,6 @@ $(document).ready(function () {
}
$plugin.data('initialized', 1);
$titles.hide();
if ($categories.length > 1) {
if ($empty) {
$categories.hide();

View File

@ -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'),

View File

@ -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'):

View File

@ -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',
),
))

View File

@ -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')

View File

@ -1,6 +1,10 @@
{% load i18n %}
<div id="profile-form-plugin-{{ instance.id }}" class="profile-form-plugin">
<div id="id_username_wrap">
<label for="id_username_wrap">{% trans "Username" %}&nbsp;:</label>
<p id="id_username">{{ user.username }}</p>
</div>
<div id="id_email_wrap">
<label for="id_email_wrap">{% trans "Email" %}&nbsp;:</label>
<p id="id_email">{{ user.email }}</p>

View File

@ -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')),
)

View File

@ -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

View File

@ -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',