Change History (12)

I'm not immediately convinced that the behavior should be changed instead of correcting the documentation to reflect the current behavior. Has the behavior changed since the documentation was introduced in 0207bdd2d4157c542c981264c86706b78ca246e9 or was the original documentation inaccurate?

The functionality hasn't changed since the documentation was updated, so it seems as though the original documentation was inaccurate. While I do have a ​PR in for the fix (WIP), I agree that it may make more sense to simply correct the documentation.
On the other hand, I do feel that this functionality would be useful as an additional overridable property for the ModelAdmin. Perhaps as an optional empty_string_display property?

I've grown wearisome of all the ModelAdmin hooks and complexity that they add. That's the only grounds on which I'd object to an additional property. If you have a compelling use case, I guess it's okay. I guess you're finding empty_value_display useful?

I would definitely find it useful if it worked with empty strings as well as None. Currently we have a field in our ModelAdmin that is a CharField with blank=True and null=False and that field is also specified in the list_display_links. Thus, when that field value is an empty string we are unable to click it (you can see this in the image attached to this ticket).

Seeing as the blank=True, null=False method is the recommended method for supporting nullable CharFields I imagine that I'm not the only person whose seen this problem. I am open to either allowing empty_value_display to acknowledge empty strings or to creating a new optional attribute for empty strings.

I don't know if adding a separate property will be simpler than modifying the existing empty_value_display. I guess there could be use cases for a separate value for each case. You could write to the DevelopersMailingList for further feedback.

I haven't yet seen a reason not to re-use empty_value_display here (rather than add a new admin option) but we need to consider when that is applied:

There are some cases where I really do want an empty string displayed (though not in a linked column). Maybe only use it only when it's an auto-linked field/column? Or maybe only use this behavior in display_for_field()? (So if you use a custom function/method, you can still have full control.) — ​Collin Anderson on Django Dev