(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<term_id>\d+)/$', 'admin_term_edit'),
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:
<ul>
<li><a href="depts/">Departments</a></li>
<li><a href="terms/">Terms</a></li>
+ <li><a href="courses/">Courses</a></li>
+ <li><a href="items/">Items</a></li>
<li><a href="news/">News Items</a></li>
</ul>
</body>