Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use value from model_to_dict instead of getattr #346

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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