1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Replace all instances of .extra() in QuerySets with annotations, including references in docstrings

This commit is contained in:
chambersh1129
2019-09-29 01:15:46 -04:00
parent 0a921d37f8
commit bdb3838d71
3 changed files with 12 additions and 10 deletions

View File

@@ -6,7 +6,7 @@ class PrefixQuerySet(QuerySet):
def annotate_depth(self, limit=None):
"""
Iterate through a QuerySet of Prefixes and annotate the hierarchical level of each. While it would be preferable
to do this using .extra() on the QuerySet to count the unique parents of each prefix, that approach introduces
to do this using .annotate() on the QuerySet to count the unique parents of each prefix, that approach introduces
performance issues at scale.
Because we're adding a non-field attribute to the model, annotation must be made *after* any QuerySet