Show the word "None" when dropdowns are empty
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.template import Library
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
register = Library()
|
||||
|
||||
@@ -11,3 +12,5 @@ def get_choice_value(field):
|
||||
return dict(field.field.choices)[field.value()]
|
||||
except TypeError:
|
||||
return ', '.join([entry for id, entry in field.field.choices])
|
||||
except KeyError:
|
||||
return _('None')
|
||||
|
||||
Reference in New Issue
Block a user