Skip to content

Commit

Permalink
lets use enums in the form template tags now
Browse files Browse the repository at this point in the history
  • Loading branch information
fredkingham committed Mar 16, 2017
1 parent 8ba7e64 commit 0911986
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions opal/templatetags/forms.py
Expand Up @@ -71,10 +71,10 @@ def infer_from_subrecord_field_path(subRecordFieldPath):

# for all django fields we'll get an empty list back
# we default for free text or foreign keys
choices = getattr(field, "choices", [])
enum = model.get_field_enum(field_name)

if choices:
ctx["lookuplist"] = json.dumps([i[1] for i in choices])
if enum:
ctx["lookuplist"] = json.dumps(enum)
elif hasattr(field, "foreign_model"):
ctx["lookuplist"] = "{}_list".format(
field.foreign_model.get_api_name()
Expand Down

0 comments on commit 0911986

Please sign in to comment.