mirror of
https://github.com/django/django.git
synced 2025-10-25 22:56:12 +00:00
Fixed the way symmetrical many-to-many relations are recorded in the Options class.
These types of relations don't have reverse accessor names, so that name can be used by a normal field on the model. Fixed #7107. git-svn-id: http://code.djangoproject.com/svn/django/trunk@7764 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -274,14 +274,17 @@ class Options(object):
|
||||
"""
|
||||
Initialises the field name -> field object mapping.
|
||||
"""
|
||||
cache = dict([(f.name, (f, m, True, False)) for f, m in
|
||||
self.get_fields_with_model()])
|
||||
for f, model in self.get_m2m_with_model():
|
||||
cache[f.name] = (f, model, True, True)
|
||||
cache = {}
|
||||
# We intentionally handle related m2m objects first so that symmetrical
|
||||
# m2m accessor names can be overridden, if necessary.
|
||||
for f, model in self.get_all_related_m2m_objects_with_model():
|
||||
cache[f.field.related_query_name()] = (f, model, False, True)
|
||||
for f, model in self.get_all_related_objects_with_model():
|
||||
cache[f.field.related_query_name()] = (f, model, False, False)
|
||||
for f, model in self.get_m2m_with_model():
|
||||
cache[f.name] = (f, model, True, True)
|
||||
for f, model in self.get_fields_with_model():
|
||||
cache[f.name] = (f, model, True, False)
|
||||
if self.order_with_respect_to:
|
||||
cache['_order'] = OrderWrt(), None, True, False
|
||||
if app_cache_ready():
|
||||
|
||||
Reference in New Issue
Block a user