Browse Source

Tag valueof precisa trabalhar com dicts também

pull/177/head
Sesostris Vieira 6 months ago
parent
commit
178c675472
  1. 2
      sigi/apps/utils/templatetags/sigi_tags.py

2
sigi/apps/utils/templatetags/sigi_tags.py

@ -42,6 +42,8 @@ def multiply(value, arg):
def valueof(obj, attr_name):
if hasattr(obj, attr_name):
return getattr(obj, attr_name)
if attr_name in obj:
return obj[attr_name]
if isinstance(obj, models.Model):
for part in attr_name.split("__"):
obj = getattr(obj, part)

Loading…
Cancel
Save