Re: Django Admin does not use `get_FOO_display`

2023-04-05 Thread Opeoluwa Fatunmbi
The reason why your overridden get_status_display method is not being applied in the Django admin is because the admin's display_for_field function uses the flatchoices attribute of the field to retrieve the display value of the field's current value. The flatchoices attribute is a list of

Django Admin does not use `get_FOO_display`

2023-04-04 Thread 'Ibrahim Abou Elenein' via Django users
I had a model having a field that uses Choices status = FSMField(default=STATUSES.PENDING, choices=STATUSES, protected=True) I did override the `get_status_display ` and its effect was not applied in the Django admin I looked up Django code and found ``` def display_for_field(value,