#33398: ModelAdmin.empty_value_display example in docs should use list_display. --------------------------------------+------------------------------------ Reporter: Michael | Owner: nobody Type: Cleanup/optimization | Status: new Component: Documentation | Version: 4.0 Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 1 | UI/UX: 0 --------------------------------------+------------------------------------
Comment (by Michael): Sure I will create a patch, before I submit it, would you please review the following, because I am not 100% sure I understand how the readonly functionality works for the `empty_value`: Change from: {{{ 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') @admin.display(empty_value='???') def view_birth_date(self, obj): return obj.birth_date }}} To: {{{ You can also override ``empty_value_display`` for all admin pages with :attr:`AdminSite.empty_value_display`. To override just a specific ``list_display`` field, or one of the ``readonly_fields``, one can do so like this:: from django.contrib import admin class AuthorAdmin(admin.ModelAdmin): list_display = ('name', 'title', 'view_birth_date') readonly_fields = ('view_birth_date', ) fields = ('name', 'title', 'view_birth_date') @admin.display(empty_value='???') def view_birth_date(self, obj): return obj.birth_date }}} -- Ticket URL: <https://code.djangoproject.com/ticket/33398#comment:2> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.70647329a7a5d62f235b256c155e401f%40djangoproject.com.