Display correct labels in the admin when get_FIELDNAME_display is used as a readonly field. Re #26

This commit is contained in:
Aram Dulyan 2017-02-08 17:54:51 +11:00
parent 346b8e3f41
commit 76a9df55f5

View file

@ -144,6 +144,7 @@ class MultiSelectField(models.CharField):
def get_display(obj):
return ", ".join(get_list(obj))
get_display.short_description = self.verbose_name
setattr(cls, 'get_%s_list' % self.name, get_list)
setattr(cls, 'get_%s_display' % self.name, get_display)