1
0
mirror of https://github.com/django/django.git synced 2024-12-25 02:26:12 +00:00

Fixed #19049 -- Corrected dumb logic negation error from earlier patch.

This commit is contained in:
Russell Keith-Magee 2012-10-03 09:14:55 +08:00
parent 3b6f980bed
commit 43530384b7

View File

@ -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)