Adjust HostManager and update summary host query

This commit is contained in:
Wayne Witzel III
2017-08-21 04:01:58 -04:00
parent c352ea7596
commit eb6a27653f
3 changed files with 6 additions and 21 deletions

View File

@@ -40,9 +40,11 @@ class HostManager(models.Manager):
#
# If we don't disable this, a filter of {'inventory': self.instance} gets automatically
# injected by the related object mapper.
self.core_filters = {}
self.core_filters.pop('inventory', None)
qs = qs & q
return qs.order_by('pk').distinct('name')
unique_by_name = qs.order_by('name', 'pk').distinct('name')
return qs.filter(pk__in=unique_by_name)
return qs