Refactor common functions for creating admin user list, peformance tweaks

This commit is contained in:
ErikKalkoken
2020-02-08 00:51:13 +01:00
parent c1388bf23f
commit 47babf2ed7
5 changed files with 179 additions and 340 deletions

View File

@@ -50,11 +50,14 @@ if _has_auto_groups:
value = self.value()
if value == 'Yes':
return queryset.exclude(
managedalliancegroup__exact=None,
managedcorpgroup__exact=None
managedalliancegroup__isnull=True,
managedcorpgroup__isnull=True
)
elif value == 'No':
return queryset.filter(managedalliancegroup__exact=None).filter(managedcorpgroup__exact=None)
return queryset.filter(
managedalliancegroup__isnull=True,
managedcorpgroup__isnull=True
)
else:
return queryset