fix: allow "N/A" option for animal sex
This commit is contained in:
parent
aecbfc6c02
commit
3336294b3b
1 changed files with 5 additions and 1 deletions
|
|
@ -23,6 +23,8 @@
|
|||
Master view for Animals
|
||||
"""
|
||||
|
||||
from collections import OrderedDict
|
||||
|
||||
from webhelpers2.html import tags
|
||||
|
||||
from wuttaweb.forms.schema import WuttaDictEnum
|
||||
|
|
@ -294,7 +296,9 @@ class AnimalAssetView(AssetMasterView):
|
|||
if not (self.creating or self.editing) and animal.sex is None:
|
||||
pass # TODO: dict enum widget does not handle null values well
|
||||
else:
|
||||
f.set_node("sex", WuttaDictEnum(self.request, enum.ANIMAL_SEX))
|
||||
# nb. ensure empty option appears like we want
|
||||
sex_enum = OrderedDict([("", "N/A")] + list(enum.ANIMAL_SEX.items()))
|
||||
f.set_node("sex", WuttaDictEnum(self.request, sex_enum))
|
||||
f.set_required("sex", False)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue