From 43530384b7f2a18b44e06e7043b988427b334653 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Wed, 3 Oct 2012 09:14:55 +0800 Subject: [PATCH] Fixed #19049 -- Corrected dumb logic negation error from earlier patch. --- django/db/models/fields/related.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py index 2c35411d7c..157640c0e3 100644 --- a/django/db/models/fields/related.py +++ b/django/db/models/fields/related.py @@ -1026,7 +1026,7 @@ class ForeignKey(RelatedField, Field): def contribute_to_related_class(self, cls, related): # Internal FK's - i.e., those with a related name ending with '+' - # and swapped models don't get a related descriptor. - if not self.rel.is_hidden() and related.model._meta.swapped: + if not self.rel.is_hidden() and not related.model._meta.swapped: setattr(cls, related.get_accessor_name(), ForeignRelatedObjectsDescriptor(related)) if self.rel.limit_choices_to: cls._meta.related_fkey_lookups.append(self.rel.limit_choices_to)