diff --git a/help/fr/install-debian.page b/help/fr/install-debian.page index 2ad1a1d..f093b38 100644 --- a/help/fr/install-debian.page +++ b/help/fr/install-debian.page @@ -47,7 +47,7 @@ New python executable in virtualenv/bin/python (...) Successfully installed django-crispy-forms django-sekizai pypdf flup django-debug-toolbar gunicorn django-cas - django-grappelli django-classy-tags + django-admin-tools django-classy-tags Cleaning up... Creating .pyc files (compileall) ....done diff --git a/help/fr/install-rpm-5.page b/help/fr/install-rpm-5.page index 6d75742..c423239 100644 --- a/help/fr/install-rpm-5.page +++ b/help/fr/install-rpm-5.page @@ -69,7 +69,7 @@ New python executable in virtualenv/bin/python (...) Successfully installed django-crispy-forms django-sekizai pypdf flup django-debug-toolbar gunicorn django-cas - django-grappelli django-classy-tags + django-admin-tools django-classy-tags Cleaning up... Creating .pyc files (compileall) ....done diff --git a/help/fr/install-source.page b/help/fr/install-source.page index eaedcdf..e311f8f 100644 --- a/help/fr/install-source.page +++ b/help/fr/install-source.page @@ -125,10 +125,10 @@ nécessaires.

django-cas

-

prendre la version compatible avec Django 1.4 : https://bitbucket.org/cpcc/django-cas/get/tip.tar.gz

+

-

django-grappelli

+

django-admin-tools

diff --git a/local_settings.py.example b/local_settings.py.example index a006233..66a1ce3 100644 --- a/local_settings.py.example +++ b/local_settings.py.example @@ -70,8 +70,6 @@ STATICFILES_DIRS = ( # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. ) -# grappelli admin -- see http://readthedocs.org/docs/django-grappelli -GRAPPELLI_ADMIN_TITLE = 'Administration de PolyNum' # templates TEMPLATE_DIRS = ( # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". diff --git a/polynum/base/templates/admin/base_site.html b/polynum/base/templates/admin/base_site.html new file mode 100644 index 0000000..d79c4de --- /dev/null +++ b/polynum/base/templates/admin/base_site.html @@ -0,0 +1,18 @@ +{% extends "admin/base.html" %} +{% load i18n %} +{% load url from future %} + +{% block title %}PolyNum :: Administration{% endblock %} + +{% block branding %} +

PolyNum — Administration

+{% endblock %} + +{% block userlinks %} + {% trans 'Return to site' %} | + {% trans 'Documentation' %} | + {% trans 'Log out' %} +{% endblock %} + +{% block nav-global %}{% endblock %} + diff --git a/polynum/dashboard.py b/polynum/dashboard.py index 92dfafc..5822bae 100644 --- a/polynum/dashboard.py +++ b/polynum/dashboard.py @@ -1,19 +1,38 @@ # -*- encoding: utf-8 -*- -from django.utils.translation import ugettext_lazy as _ +""" +django-admin-tools : this file was generated with the customdashboard +management command, it contains the two classes for the main dashboard and app +index dashboard. You can customize these classes as you want. + +See http://django-admin-tools.readthedocs.org/en/latest/dashboard.html +""" + +from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse + +from admin_tools.dashboard import modules, Dashboard, AppIndexDashboard +from admin_tools.utils import get_admin_site_name -from grappelli.dashboard import modules, Dashboard class CustomIndexDashboard(Dashboard): """ - Custom index dashboard for polynum + Custom index dashboard for PolyNum """ + columns = 2 + title = None + def init_with_context(self, context): - self.children.append(modules.ModelList( + + site_name = get_admin_site_name(context) + + self.children.append(modules.ModelList( _(u'Groupes, utilisateurs et rôles'), - column=1, - collapsible=False, + layout='inline', + draggable=True, + collapsible=True, + deletable=False, models=('polynum.base.models.user.PolynumUser', 'django.contrib.auth.models.User', 'django.contrib.auth.models.Group', @@ -23,18 +42,19 @@ class CustomIndexDashboard(Dashboard): self.children.append(modules.ModelList( _(u'Demandes'), - column=1, - collapsible=False, + draggable=True, + collapsible=True, + deletable=False, models=('polynum.base.models.request.Request', ), )) self.children.append(modules.ModelList( - _(u'Paramètres des documents'), - column=1, - collapsible=True, - css_classes=['grp-closed'], - models=( + _(u'Paramètres des documents'), + draggable=True, + collapsible=True, + deletable=False, + models=( 'polynum.base.models.request.DeliveryPlace', 'polynum.base.models.request.DocumentUsage', 'polynum.base.models.request.DocumentLicence',), @@ -42,9 +62,9 @@ class CustomIndexDashboard(Dashboard): self.children.append(modules.ModelList( _(u'Profils de reprographie'), - column=1, + draggable=True, collapsible=True, - css_classes=['grp-closed'], + deletable=False, models=('polynum.base.models.profile.Profile', 'polynum.base.models.profile.ProfileOption', #'polynum.base.models.profile.ProfileOptionChoice', @@ -53,9 +73,9 @@ class CustomIndexDashboard(Dashboard): self.children.append(modules.ModelList( _(u'Gestion du workflow'), - column=1, + draggable=True, collapsible=True, - css_classes=['grp-closed'], + deletable=False, models=('polynum.base.models.workflow.Status', 'polynum.base.models.workflow.Action', 'polynum.base.models.workflow.Transition', @@ -65,10 +85,39 @@ class CustomIndexDashboard(Dashboard): self.children.append(modules.ModelList( _(u'Entités'), - column=1, + draggable=True, collapsible=True, - css_classes=['grp-closed'], + deletable=False, models=('polynum.base.models.entity.Entity', 'polynum.base.models.entity.EntityType',), )) + +class CustomAppIndexDashboard(AppIndexDashboard): + """ + Custom app index dashboard for git. + """ + + # we disable title because its redundant with the model list module + title = '' + columns = 2 + + def __init__(self, *args, **kwargs): + AppIndexDashboard.__init__(self, *args, **kwargs) + + # append a model list module and a recent actions module + self.children += [ + modules.ModelList(self.app_title, self.models, + draggable=True, collapsible=True, deletable=False), + modules.RecentActions( + _('Recent Actions'), + include_list=self.get_app_content_types(), + limit=5 + ) + ] + + def init_with_context(self, context): + """ + Use this method if you need to access the request context. + """ + return super(CustomAppIndexDashboard, self).init_with_context(context) diff --git a/polynum/settings.py b/polynum/settings.py index 067787c..5f3bd6c 100644 --- a/polynum/settings.py +++ b/polynum/settings.py @@ -127,20 +127,18 @@ TEMPLATE_DIRS = ( TEMPLATE_CONTEXT_PROCESSORS = DEFAULT_SETTINGS.TEMPLATE_CONTEXT_PROCESSORS + ( 'sekizai.context_processors.sekizai', - 'django.core.context_processors.request', # needed by grappelli + 'django.core.context_processors.request', # needed by django-admin-tools ) INSTALLED_APPS = ( # note: 'south' will be added here only if database is not sqlite (see below) + # 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', - 'grappelli.dashboard', - 'grappelli', - 'django.contrib.admin', 'django.contrib.formtools', #'django.contrib.admindocs', 'sekizai', @@ -152,6 +150,10 @@ INSTALLED_APPS = ( 'polynum.editor', 'polynum.delegation', 'polynum.oai', + # admin + 'admin_tools', + 'admin_tools.dashboard', + 'django.contrib.admin', ) # From http://django-crispy-forms.readthedocs.org/en/d-0/install.html @@ -194,10 +196,12 @@ AUTHENTICATION_BACKENDS = ('polynum.base.backends.ModelBackend',) AUTH_PROFILE_MODULE = 'base.PolynumProfile' CAS_SERVER_URL = None # 'https://www.ent.dauphine.fr/cas/' -# grappelli -- see http://readthedocs.org/docs/django-grappelli -GRAPPELLI_ADMIN_TITLE = 'Administration de PolyNum' -GRAPPELLI_INDEX_DASHBOARD = 'polynum.dashboard.CustomIndexDashboard' +# django-admin-tools +# see http://django-admin-tools.readthedocs.org/en/latest/customization.html +ADMIN_TOOLS_INDEX_DASHBOARD = 'polynum.dashboard.CustomIndexDashboard' +ADMIN_TOOLS_APP_INDEX_DASHBOARD = 'polynum.dashboard.CustomAppIndexDashboard' +# Session cookies SESSION_COOKIE_AGE = 3600*24 # 1 day SESSION_EXPIRE_AT_BROWSER_CLOSE = True diff --git a/polynum/urls.py b/polynum/urls.py index e5cab00..0a70d00 100644 --- a/polynum/urls.py +++ b/polynum/urls.py @@ -23,7 +23,7 @@ urlpatterns = patterns('', # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), - url(r'^grappelli/', include('grappelli.urls')), + url(r'^admin_tools/', include('admin_tools.urls')), # django-admin-tools url(r'^admin/', include(admin.site.urls)), url(r'^request/', diff --git a/requirements b/requirements index f05c4e6..3a37272 100644 --- a/requirements +++ b/requirements @@ -4,7 +4,7 @@ south django-crispy-forms django-sekizai https://bitbucket.org/cpcc/django-cas/get/tip.tar.gz -django-grappelli +django-admin-tools pypdf flup django-debug-toolbar diff --git a/setup.py b/setup.py index f457ab9..d873407 100644 --- a/setup.py +++ b/setup.py @@ -22,8 +22,8 @@ setup(name="Polynum", 'django-crispy-forms', 'django-sekizai', 'pypdf', - 'django-cas >= 2.1.1', # not in pypi => pip install https://bitbucket.org/cpcc/django-cas/get/tip.tar.gz - 'django-grappelli >= 2.4', # not in pypi => pip install git+https://github.com/sehmaschine/django-grappelli@grappelli_2_4 + 'django-cas >= 2.1.1', + 'django-admin-tools', 'flup', 'psycopg2', ],