diff --git a/awx/api/filters.py b/awx/api/filters.py index fc42a98c41..b196a383f0 100644 --- a/awx/api/filters.py +++ b/awx/api/filters.py @@ -9,8 +9,9 @@ from django.core.exceptions import FieldError, ValidationError from django.db import models from django.db.models import Q from django.db.models.fields import FieldDoesNotExist -from django.db.models.fields.related import ForeignObjectRel +from django.db.models.fields.related import ForeignObjectRel, ManyToManyField from django.contrib.contenttypes.models import ContentType +from django.contrib.contenttypes.fields import GenericForeignKey from django.utils.encoding import force_text # Django REST Framework @@ -129,7 +130,7 @@ class FieldLookupBackend(BaseFilterBackend): return to_python_boolean(value, allow_none=True) elif isinstance(field, models.BooleanField): return to_python_boolean(value) - elif isinstance(field, ForeignObjectRel): + elif isinstance(field, (ForeignObjectRel, ManyToManyField, GenericForeignKey)): return self.to_python_related(value) else: return field.to_python(value)