mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-29 11:56:25 -06:00
12596 review changes
This commit is contained in:
parent
dd7ad239b7
commit
1b87880afb
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user