Skip to content

Commit 346fa6b

Browse files
foarsittervdboor
authored andcommitted
Added a fallback for model._base_objects to mode.objects when we have a non-polymorphic parent fixes #9
1 parent 44fd8b7 commit 346fa6b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

polymorphic/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,8 @@ def __init__(self, *args, **kwargs):
203203

204204
def create_accessor_function_for_model(model, accessor_name):
205205
def accessor_function(self):
206-
attr = model._base_objects.get(pk=self.pk)
206+
objects = getattr(model, "_base_objects", model.objects)
207+
attr = objects.get(pk=self.pk)
207208
return attr
208209

209210
return accessor_function

0 commit comments

Comments
 (0)