Skip to content

Commit

Permalink
fix rendering of fields in templates (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuadavidthomas authored Jan 11, 2024
1 parent 7ffdb47 commit ee07b35
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/neapolitan/templatetags/neapolitan.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def object_detail(object, fields):
def iter():
for f in fields:
mf = object._meta.get_field(f)
yield (mf.verbose_name, mf.value_to_string(object))
yield (mf.verbose_name, str(getattr(object, f)))

return {"object": iter()}

Expand All @@ -60,10 +60,8 @@ def object_list(objects, fields):
headers = [objects[0]._meta.get_field(f).verbose_name for f in fields]
object_list = [
{
"object": {f: getattr(object, f) for f in fields},
"fields": [
{"name": f, "value": object._meta.get_field(f).value_to_string(object)} for f in fields
],
"object": object,
"fields": [{"name": f, "value": str(getattr(object, f))} for f in fields],
"actions": action_links(object),
}
for object in objects
Expand Down

0 comments on commit ee07b35

Please sign in to comment.