-
-
Notifications
You must be signed in to change notification settings - Fork 302
Description
Hello,
It appears as if it is not possible to filter or exclude on fields which start with an _.
For example: MyPolymorphicModel.objects.filter(related_object___related_object_field="query") raises AttributeError: 'module' object has no attribute 'get_model' (Note: the field on related_object is _related_object_field with a leading underscore).
Based on the line comment here: https://github.com/django-polymorphic/django-polymorphic/blob/master/polymorphic/query_translate.py#L133, it appears as if the existence of a triple underscore in a filter expression implies that some polymorphic filtering should occur. This is not the case in my example, and it seems very limiting to assume that any query with a triple underscore is attempting to filter for a polymorphic field rather than a field which has a name starting with an underscore.
Thanks for your help!