Mass active flag code removal

This commit is contained in:
Akita Noek
2016-03-10 16:44:55 -05:00
parent ba833d683e
commit 6ea99583da
27 changed files with 272 additions and 417 deletions

View File

@@ -13,9 +13,9 @@ class HostManager(models.Manager):
def active_count(self):
"""Return count of active, unique hosts for licensing."""
try:
return self.filter(active=True, inventory__active=True).order_by('name').distinct('name').count()
return self.order_by('name').distinct('name').count()
except NotImplementedError: # For unit tests only, SQLite doesn't support distinct('name')
return len(set(self.filter(active=True, inventory__active=True).values_list('name', flat=True)))
return len(set(self.values_list('name', flat=True)))
class InstanceManager(models.Manager):
"""A custom manager class for the Instance model.