Skip to content

Commit

Permalink
fix: use value from model_to_dict instead of getattr
Browse files Browse the repository at this point in the history
This gives us a more meaningful represeantaion of the value
  • Loading branch information
b1rger committed Oct 18, 2023
1 parent 53b3e10 commit 2e2f5fe
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions apis_core/apis_entities/detail_generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,9 @@ def get(self, request, *args, **kwargs):
]
entity_settings = get_entity_settings_by_modelname(self.entity)
exclude_fields.extend(entity_settings.get("detail_view_exclude", []))
for field in model_to_dict(self.instance).keys():
for field, value in model_to_dict(self.instance).items():
if field not in exclude_fields:
relevant_fields.append(
(
self.instance._meta.get_field(field),
getattr(self.instance, field),
)
)
relevant_fields.append((self.instance._meta.get_field(field), value))

return HttpResponse(
template.render(
Expand Down

0 comments on commit 2e2f5fe

Please sign in to comment.