summaryrefslogtreecommitdiff
path: root/django/db/models
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-03-08 03:21:35 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2007-03-08 03:21:35 +0000
commit43809de79db2dfd3f967f4c95bca98f8f6c75fb5 (patch)
tree217654fe841a9ae3be09e9bd5477f68db2339b0c /django/db/models
parent98b2e0a035fefa777cfda5a48283cd014703a505 (diff)
Fixed #1839, #2415, #2536 -- Fixed a generated name clash that was common in
self-referential and circular relations. A lot of community debugging went into this fix, so thanks to bmurdock@gmail.com, Marek Kubica, ramiro, Michael Radziej (the last two giving test cases showing the problem) and James Bennett (who did the hard work to actually diagnose the true problem and fix it). git-svn-id: http://code.djangoproject.com/svn/django/trunk@4676 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/models')
-rw-r--r--django/db/models/related.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/db/models/related.py b/django/db/models/related.py
index a63f09b745..8c64b464ec 100644
--- a/django/db/models/related.py
+++ b/django/db/models/related.py
@@ -1,7 +1,7 @@
class BoundRelatedObject(object):
def __init__(self, related_object, field_mapping, original):
self.relation = related_object
- self.field_mappings = field_mapping[related_object.opts.module_name]
+ self.field_mappings = field_mapping[related_object.name]
def template_name(self):
raise NotImplementedError
@@ -16,7 +16,7 @@ class RelatedObject(object):
self.opts = model._meta
self.field = field
self.edit_inline = field.rel.edit_inline
- self.name = self.opts.module_name
+ self.name = '%s_%s' % (self.opts.app_label, self.opts.module_name)
self.var_name = self.opts.object_name.lower()
def flatten_data(self, follow, obj=None):