Skip to content

Commit

Permalink
12596 review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
arthanson committed Nov 15, 2024
1 parent dd7ad23 commit 1b87880
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions netbox/utilities/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,7 @@ def get_annotations_for_serializer(serializer_class, fields_to_include=None):

for field_name, field in serializer_class._declared_fields.items():
if field_name in fields_to_include and type(field) is RelatedObjectCountField:
try:
related_field = model._meta.get_field(field.relation).field
except FieldDoesNotExist:
# Handle RelatedObjectCountField with no related_name given
related_field = getattr(model, field.relation).field

related_field = getattr(model, field.relation).field
annotations[field_name] = count_related(related_field.model, related_field.name)

return annotations
Expand Down

0 comments on commit 1b87880

Please sign in to comment.