ModelAdmin.empty_value_display
New in Django 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 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.empty_value_display = '???'
Please login to continue.