summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2007-04-07 04:36:58 +0000
committerAdrian Holovaty <adrian@holovaty.com>2007-04-07 04:36:58 +0000
commitd6d173f8e1fab286522abf7764fcfeb1e87ef380 (patch)
tree99bcec9b603ae49d786197233ec8656b1776ada1
parent54950e5dad347ce49ff98647258bdb66b59fc307 (diff)
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
-rw-r--r--django/contrib/flatpages/models.py24
1 files 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)