From 30630647c4edfb644cc8c03edf4838058ca83d8f Mon Sep 17 00:00:00 2001 From: Diederik van der Boor Date: Sat, 30 Sep 2017 20:26:52 +0200 Subject: [PATCH] Add extra comment why deferred fields are skipped with ___ lookups --- polymorphic/query.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/polymorphic/query.py b/polymorphic/query.py index 454c526..97fc21a 100644 --- a/polymorphic/query.py +++ b/polymorphic/query.py @@ -393,6 +393,9 @@ class PolymorphicQuerySet(QuerySet): # now a superclass of real_concrete_class. Thus it's # sufficient to just use the field name. translated_field_name = field.rpartition('___')[-1] + + # Check if the field does exist. + # Ignore deferred fields that don't exist in this subclass type. try: real_concrete_class._meta.get_field(translated_field_name) except FieldDoesNotExist: