From ef2ef3a33735f197d709455ab7643215b6f078b9 Mon Sep 17 00:00:00 2001 From: artunit Date: Mon, 16 Mar 2009 22:48:09 +0000 Subject: [PATCH] simple decorator add copy to work through courses and items git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@189 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- conifer/syrup/urls.py | 2 ++ conifer/syrup/views.py | 34 ++++++++++++++++++++++++++++++++++ conifer/templates/admin/index.xhtml | 2 ++ 3 files changed, 38 insertions(+) diff --git a/conifer/syrup/urls.py b/conifer/syrup/urls.py index 8b659d4..8c4a1c8 100644 --- a/conifer/syrup/urls.py +++ b/conifer/syrup/urls.py @@ -35,6 +35,8 @@ urlpatterns = patterns('conifer.syrup.views', (ITEM_PREFIX + r'add/$', 'item_add'), # for adding sub-things (r'^admin/$', 'admin_index'), (r'^admin/terms/' + GENERIC_REGEX, 'admin_terms'), + (r'^admin/courses/' + GENERIC_REGEX, 'admin_courses'), + (r'^admin/items/' + GENERIC_REGEX, 'admin_items'), (r'^admin/depts/' + GENERIC_REGEX, 'admin_depts'), (r'^admin/news/' + GENERIC_REGEX, 'admin_news'), # (r'^admin/terms/(?P\d+)/$', 'admin_term_edit'), diff --git a/conifer/syrup/views.py b/conifer/syrup/views.py index 7bd579f..a66efed 100644 --- a/conifer/syrup/views.py +++ b/conifer/syrup/views.py @@ -851,6 +851,40 @@ class DeptForm(ModelForm): admin_depts = generic_handler(DeptForm, decorator=admin_only) +### +# graham - zap this if it messes anything up :-) +### +class CourseForm(ModelForm): + class Meta: + model = models.Course + + class Index: + title = _('Courses') + all = models.Course.objects.order_by('code').all + cols = ['code', 'title'] + links = [0,1] + + clean_code = strip_and_nonblank('code') + clean_title = strip_and_nonblank('title') + +admin_courses = generic_handler(CourseForm, decorator=admin_only) + +class ItemForm(ModelForm): + class Meta: + model = models.Item + + class Index: + title = _('Items') + all = models.Item.objects.order_by('title').all + cols = ['title', 'author'] + links = [0,1] + + clean_title = strip_and_nonblank('title') + clean_author = strip_and_nonblank('author') + +admin_items = generic_handler(ItemForm, decorator=admin_only) +### + class NewsForm(ModelForm): class Meta: diff --git a/conifer/templates/admin/index.xhtml b/conifer/templates/admin/index.xhtml index 47684f4..935c366 100644 --- a/conifer/templates/admin/index.xhtml +++ b/conifer/templates/admin/index.xhtml @@ -13,6 +13,8 @@ title = _('Administrative Options') -- 2.11.0