From c9a96075fa02b6d52bec748ffdfb413688a15774 Mon Sep 17 00:00:00 2001 From: Anssi Kääriäinen Date: Mon, 20 May 2013 17:40:34 +0300 Subject: Fixed #20378 -- regression in GenericRelation on abstract model When a GenericRelation was defined on abstract model, queries on childs of the abstract model didn't work. The problem was in the way fields and in particular field.rel was copied from models to their children. The regression was likely caused by #19385. Thanks to Gavin Wahl for spotting the regression. --- django/db/models/fields/__init__.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'django') diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py index 13cec1bfba..7d01391d4f 100644 --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -157,6 +157,8 @@ class Field(object): obj = copy.copy(self) if self.rel: obj.rel = copy.copy(self.rel) + if hasattr(self.rel, 'field') and self.rel.field is self: + obj.rel.field = obj memodict[id(self)] = obj return obj -- cgit v1.3