mirror of
https://github.com/django/django.git
synced 2025-07-04 17:59:13 +00:00
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
This commit is contained in:
parent
54950e5dad
commit
d6d173f8e1
@ -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'."))
|
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."))
|
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)
|
sites = models.ManyToManyField(Site)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
db_table = 'django_flatpage'
|
db_table = 'django_flatpage'
|
||||||
verbose_name = _('flat page')
|
verbose_name = _('flat page')
|
||||||
verbose_name_plural = _('flat pages')
|
verbose_name_plural = _('flat pages')
|
||||||
ordering = ('url',)
|
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):
|
def __str__(self):
|
||||||
return "%s -- %s" % (self.url, self.title)
|
return "%s -- %s" % (self.url, self.title)
|
||||||
|
|
||||||
def get_absolute_url(self):
|
def get_absolute_url(self):
|
||||||
return self.url
|
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)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user