mirror of
https://github.com/django/django.git
synced 2025-08-03 18:38:50 +00:00
Fixed #25262 -- Removed the enable_comments field from FlatPageAdmin.
This commit is contained in:
parent
e75882332c
commit
b649f68649
4 changed files with 44 additions and 4 deletions
|
@ -330,7 +330,7 @@ subclass::
|
|||
}),
|
||||
('Advanced options', {
|
||||
'classes': ('collapse',),
|
||||
'fields': ('enable_comments', 'registration_required', 'template_name')
|
||||
'fields': ('registration_required', 'template_name'),
|
||||
}),
|
||||
)
|
||||
|
||||
|
|
|
@ -170,6 +170,8 @@ For more on middleware, read the :doc:`middleware docs
|
|||
How to add, change and delete flatpages
|
||||
=======================================
|
||||
|
||||
.. _flatpages-admin:
|
||||
|
||||
Via the admin interface
|
||||
-----------------------
|
||||
|
||||
|
@ -177,6 +179,38 @@ If you've activated the automatic Django admin interface, you should see a
|
|||
"Flatpages" section on the admin index page. Edit flatpages as you edit any
|
||||
other object in the system.
|
||||
|
||||
The ``FlatPage`` model has an ``enable_comments`` field that isn't used by
|
||||
``contrib.flatpages``, but that could be useful for your project or third-party
|
||||
apps. It doesn't appear in the admin interface, but you can add it by
|
||||
registering a custom ``ModelAdmin`` for ``FlatPage``::
|
||||
|
||||
from django.contrib import admin
|
||||
from django.contrib.flatpages.admin import FlatPageAdmin
|
||||
from django.contrib.flatpages.models import FlatPage
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
# Define a new FlatPageAdmin
|
||||
class FlatPageAdmin(FlatPageAdmin):
|
||||
fieldsets = (
|
||||
(None, {'fields': ('url', 'title', 'content', 'sites')}),
|
||||
(_('Advanced options'), {
|
||||
'classes': ('collapse', ),
|
||||
'fields': (
|
||||
'enable_comments',
|
||||
'registration_required',
|
||||
'template_name',
|
||||
),
|
||||
}),
|
||||
)
|
||||
|
||||
# Re-register FlatPageAdmin
|
||||
admin.site.unregister(FlatPage)
|
||||
admin.site.register(FlatPage, FlatPageAdmin)
|
||||
|
||||
.. versionchanged:: 1.9
|
||||
|
||||
The ``enable_comments`` field was removed from ``FlatPageAdmin``.
|
||||
|
||||
Via the Python API
|
||||
------------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue