mirror of
https://github.com/django/django.git
synced 2025-08-20 10:40:32 +00:00
[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:
parent
136edac897
commit
20b621eb3c
8 changed files with 34 additions and 34 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue