Update Django to 1.8 and DRF to 3.3, add new Django migrations, update serializers/pagination/metadata, update browsable API styling.

This commit is contained in:
Chris Church
2016-02-02 14:50:42 -05:00
parent 6242df1a07
commit 60224cdbe4
140 changed files with 2694 additions and 1375 deletions

View File

@@ -12,10 +12,11 @@ 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).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)))
#try:
# return self.filter(active=True, inventory__active=True).distinct('name').count()
#except NotImplementedError: # For unit tests only, SQLite doesn't support distinct('name')
# FIXME-CC
return len(set(self.filter(active=True, inventory__active=True).values_list('name', flat=True)))
class InstanceManager(models.Manager):
"""A custom manager class for the Instance model.