Skip to content

Commit

Permalink
Fix lookup bug
Browse files Browse the repository at this point in the history
  • Loading branch information
UmSenhorQualquer committed Apr 19, 2019
1 parent a08104c commit 5a4618d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pyforms_web/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,10 @@ def get_lookup_value(obj, lookup):
Return the value of a lookup over an object
"""
value = None
if obj:
if obj is not None:
for fieldname in lookup.split(LOOKUP_SEP):
if obj is None:
return None
try:
# works for fields with choices defines
obj = getattr(obj, 'get_%s_display' % fieldname)
Expand Down

0 comments on commit 5a4618d

Please sign in to comment.