5monkeys / django-enumfield

Custom Django field for using enumerations of named constants
MIT License
204 stars 46 forks source link

_get_FIELD_display throws error if value is None #58

Open twschiller opened 4 years ago

twschiller commented 4 years ago

In the 2.0 release, _get_FIELD_display throws an error if the value is None. I think the code needs to be changed to:

def _get_FIELD_display(self, cls):
    value = getattr(cls, self.attname)
    if value is None:
         return value
    return force_text(value.label, strings_only=True)
Mojken commented 2 years ago

This was resolved, right? Why is the issue still open?