Revert isinstance, circular imports due to when the HostManager exists for an Inventory

This commit is contained in:
Wayne Witzel III 2017-05-02 13:16:53 -04:00
parent af35838aff
commit e46a043213

View File

@ -11,6 +11,8 @@ from django.conf import settings
from awx.main.utils.filters import DynamicFilter
___all__ = ['HostManager', 'InstanceManager']
class HostManager(models.Manager):
"""Custom manager class for Hosts model."""
@ -27,7 +29,9 @@ class HostManager(models.Manager):
set. Use the `host_filter` to generate the queryset for the hosts.
"""
qs = super(HostManager, self).get_queryset()
if hasattr(self, 'instance') and isinstance(self.instance, models.Inventory):
if (hasattr(self, 'instance') and
hasattr(self.instance, 'host_filter') and
hasattr(self.instance, 'kind')):
if self.instance.kind == 'dynamic' and self.instance.host_filter is not None:
q = DynamicFilter.query_from_string(self.instance.host_filter)
# If we are using host_filters, disable the core_filters, this allows