From bb430fd2a77dfcc3bcecee99c07662e7126e737d Mon Sep 17 00:00:00 2001 From: Oskar Hahn Date: Fri, 13 Apr 2012 14:05:51 +0200 Subject: [PATCH] remove admin, add plugin system for openslides --- openslides/agenda/admin.py | 18 ------------------ openslides/application/admin.py | 17 ----------------- openslides/assignment/admin.py | 16 ---------------- openslides/default.settings.py | 8 ++++++++ openslides/participant/admin.py | 16 ---------------- openslides/urls.py | 14 ++++++++++++-- 6 files changed, 20 insertions(+), 69 deletions(-) delete mode 100644 openslides/agenda/admin.py delete mode 100644 openslides/application/admin.py delete mode 100644 openslides/assignment/admin.py delete mode 100644 openslides/participant/admin.py diff --git a/openslides/agenda/admin.py b/openslides/agenda/admin.py deleted file mode 100644 index 83f3f31d4..000000000 --- a/openslides/agenda/admin.py +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" - openslides.agenda.admin - ~~~~~~~~~~~~~~~~~~~~~~~ - - Register app for admin site. - - :copyright: 2011 by the OpenSlides team, see AUTHORS. - :license: GNU GPL, see LICENSE for more details. -""" - -from django.contrib import admin -from mptt.admin import MPTTModelAdmin - -from openslides.agenda.models import Item - -admin.site.register(Item, MPTTModelAdmin) diff --git a/openslides/application/admin.py b/openslides/application/admin.py deleted file mode 100644 index 7085d8e8f..000000000 --- a/openslides/application/admin.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" - openslides.application.admin - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - Register app for admin site. - - :copyright: 2011 by the OpenSlides team, see AUTHORS. - :license: GNU GPL, see LICENSE for more details. -""" - -from django.contrib import admin -from openslides.application.models import Application, AVersion - -admin.site.register(Application) -admin.site.register(AVersion) diff --git a/openslides/assignment/admin.py b/openslides/assignment/admin.py deleted file mode 100644 index 144d0732f..000000000 --- a/openslides/assignment/admin.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" - openslides.assignment.admin - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - Register app for admin site. - - :copyright: 2011 by the OpenSlides team, see AUTHORS. - :license: GNU GPL, see LICENSE for more details. -""" - -from django.contrib import admin -from assignment.models import Assignment - -admin.site.register(Assignment) diff --git a/openslides/default.settings.py b/openslides/default.settings.py index 6fc5ef22f..69f57612d 100644 --- a/openslides/default.settings.py +++ b/openslides/default.settings.py @@ -22,3 +22,11 @@ LANGUAGE_CODE = 'de' # Make this unique, and don't share it with anybody. SECRET_KEY = '=(v@$58k$fcl4y8t2#q15y-9p=^45y&!$!ap$7xo6ub$akg-!5' + +# Put your OpenSlides Plugins in this List +INSTALLED_PLUGINS = ( + +) + + +INSTALLED_APPS += INSTALLED_PLUGINS diff --git a/openslides/participant/admin.py b/openslides/participant/admin.py deleted file mode 100644 index 00e551e27..000000000 --- a/openslides/participant/admin.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -""" - openslides.participant.admin - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - - Register app for admin site. - - :copyright: 2011 by the OpenSlides team, see AUTHORS. - :license: GNU GPL, see LICENSE for more details. -""" - -from django.contrib import admin -from participant.models import Profile - -admin.site.register(Profile) diff --git a/openslides/urls.py b/openslides/urls.py index 72e74781a..bced55e75 100644 --- a/openslides/urls.py +++ b/openslides/urls.py @@ -14,12 +14,13 @@ from django.conf.urls.defaults import * from django.conf import settings from django.contrib import admin from django.views.generic import RedirectView +from django.utils.importlib import import_module +import settings -admin.autodiscover() handler500 = 'openslides.utils.views.server_error' urlpatterns = patterns('', - (r'^admin/', include(admin.site.urls)), + # frontpage (r'^$', RedirectView.as_view( url='projector/control', @@ -36,6 +37,15 @@ urlpatterns = patterns('', (r'^i18n/', include('django.conf.urls.i18n')), ) +for plugin in settings.INSTALLED_PLUGINS: + try: + mod = import_module(plugin + '.urls') + except (ImportError): + continue + + plugin_name = mod.__name__.split('.')[0] + urlpatterns += patterns('', (r'^%s/' % plugin_name, include('%s.urls' % plugin_name))) + urlpatterns += patterns('', (r'^500/$', 'openslides.utils.views.server_error'),