[1.8.x] Fixed #24289 -- Reversed usage of Field.many_to_one and one_to_many.

Thanks Carl Meyer and Tim Graham for the reviews and to all involved
in the discussion.

Backport of 18c0aaa912 from master
This commit is contained in:
Loic Bistuer 2015-02-14 01:55:36 +07:00
parent 136edac897
commit 20b621eb3c
8 changed files with 34 additions and 34 deletions

View file

@ -296,7 +296,7 @@ def _get_non_gfk_field(opts, name):
"not found" by get_field(). This could likely be cleaned up.
"""
field = opts.get_field(name)
if field.is_relation and field.one_to_many and not field.related_model:
if field.is_relation and field.many_to_one and not field.related_model:
raise FieldDoesNotExist()
return field

View file

@ -27,8 +27,8 @@ class GenericForeignKey(object):
is_relation = True
many_to_many = False
many_to_one = False
one_to_many = True
many_to_one = True
one_to_many = False
one_to_one = False
related_model = None
@ -258,8 +258,8 @@ class GenericRelation(ForeignObject):
auto_created = False
many_to_many = False
many_to_one = True
one_to_many = False
many_to_one = False
one_to_many = True
one_to_one = False
def __init__(self, to, **kwargs):