From d6d173f8e1fab286522abf7764fcfeb1e87ef380 Mon Sep 17 00:00:00 2001 From: Adrian Holovaty Date: Sat, 7 Apr 2007 04:36:58 +0000 Subject: [PATCH] newforms-admin: Converted django.contrib.flatpages model admin options to use new syntax git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@4949 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/contrib/flatpages/models.py | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/django/contrib/flatpages/models.py b/django/contrib/flatpages/models.py index 8d0b2c0d90..8f379a8ef3 100644 --- a/django/contrib/flatpages/models.py +++ b/django/contrib/flatpages/models.py @@ -13,21 +13,31 @@ class FlatPage(models.Model): help_text=_("Example: 'flatpages/contact_page.html'. If this isn't provided, the system will use 'flatpages/default.html'.")) registration_required = models.BooleanField(_('registration required'), help_text=_("If this is checked, only logged-in users will be able to view the page.")) sites = models.ManyToManyField(Site) + class Meta: db_table = 'django_flatpage' verbose_name = _('flat page') verbose_name_plural = _('flat pages') ordering = ('url',) - class Admin: - fields = ( - (None, {'fields': ('url', 'title', 'content', 'sites')}), - ('Advanced options', {'classes': 'collapse', 'fields': ('enable_comments', 'registration_required', 'template_name')}), - ) - list_filter = ('sites',) - search_fields = ('url', 'title') def __str__(self): return "%s -- %s" % (self.url, self.title) def get_absolute_url(self): return self.url + +# Register the admin options for these models. +# TODO: Maybe this should live in a separate module admin.py, but how would we +# ensure that module was loaded? + +from django.contrib import admin + +class FlatPageAdmin(admin.ModelAdmin): + fields = ( + (None, {'fields': ('url', 'title', 'content', 'sites')}), + ('Advanced options', {'classes': 'collapse', 'fields': ('enable_comments', 'registration_required', 'template_name')}), + ) + list_filter = ('sites',) + search_fields = ('url', 'title') + +admin.site.register(FlatPage, FlatPageAdmin)