1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Revert "Fixed #24474 -- Allowed configuring the admin's empty change list value."

This reverts commit 72f769f494.

There are several test failures that need to be fixed.
This commit is contained in:
Tim Graham
2015-04-08 20:39:59 -04:00
parent 72f769f494
commit 1273a7a0e8
11 changed files with 33 additions and 185 deletions

View File

@@ -205,33 +205,6 @@ subclass::
to its documentation for some caveats when time zone support is
enabled (:setting:`USE_TZ = True <USE_TZ>`).
.. attribute:: ModelAdmin.empty_value_display
.. versionadded:: 1.9
This attribute overrides the default display value for record's fields that
are empty (``None``, empty string, etc.). The default value is ``-`` (a
dash). For example::
from django.contrib import admin
class AuthorAdmin(admin.ModelAdmin):
empty_value_display = '-empty-'
You can also override ``empty_value_display`` for all admin pages with
:attr:`AdminSite.empty_value_display`, or for specific fields like this::
from django.contrib import admin
class AuthorAdmin(admin.ModelAdmin):
fields = ('name', 'title', 'view_birth_date')
def view_birth_date(self, obj):
return obj.birth_date
view_birth_date.short_name = 'birth_date'
view_birth_date.empty_value_display = '???'
.. attribute:: ModelAdmin.exclude
This attribute, if given, should be a list of field names to exclude from
@@ -610,33 +583,6 @@ subclass::
class PersonAdmin(admin.ModelAdmin):
list_display = ('first_name', 'last_name', 'colored_name')
* If the value of a field is ``None``, an empty string, or an iterable
without elements, Django will display ``-`` (a dash). You can override
this with :attr:`AdminSite.empty_value_display`::
from django.contrib import admin
admin.site.empty_value_display = '(None)'
You can also use :attr:`AdminSite.empty_value_display`::
class PersonAdmin(admin.ModelAdmin):
empty_value_display = 'unknown'
Or on a field level::
class PersonAdmin(admin.ModelAdmin):
list_display = ('name', 'birth_date_view')
def birth_date_view(self, obj):
return obj.birth_date
birth_date_view.empty_value_display = 'unknown'
.. versionadded:: 1.9
The ability to customize ``empty_value_display`` was added.
* If the string given is a method of the model, ``ModelAdmin`` or a
callable that returns True or False Django will display a pretty
"on" or "off" icon if you give the method a ``boolean`` attribute
@@ -658,6 +604,7 @@ subclass::
class PersonAdmin(admin.ModelAdmin):
list_display = ('name', 'born_in_fifties')
* The ``__str__()`` (``__unicode__()`` on Python 2) method is just
as valid in ``list_display`` as any other model method, so it's
perfectly OK to do this::
@@ -2521,16 +2468,6 @@ Templates can override or extend base admin templates as described in
Path to a custom template that will be used by the admin site app index view.
.. attribute:: AdminSite.empty_value_display
.. versionadded:: 1.9
The string to use for displaying empty values in the admin site's change
list. Defaults to a dash. The value can also be overridden on a per
``ModelAdmin`` basis and on a custom field within a ``ModelAdmin`` by
setting an ``empty_value_display`` attribute on the field. See
:attr:`ModelAdmin.empty_value_display` for examples.
.. attribute:: AdminSite.login_template
Path to a custom template that will be used by the admin site login view.