Show the word "None" when dropdowns are empty

This commit is contained in:
Roberto Rosario
2015-06-04 18:40:45 -04:00
parent 0fd86c6191
commit ed4d72c709

View File

@@ -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')