summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Long <indirecthit@gmail.com>2006-10-04 01:57:00 +0000
committerChristopher Long <indirecthit@gmail.com>2006-10-04 01:57:00 +0000
commit3f60a8e98d90c1fce40017a2e01b0b4643d91bd6 (patch)
treeb70d2a7f623ca55a9d38dae4c5faf9ad7c9e722f
parent46f6dc7e4ea3d3b69c525499569f3818efbb81fd (diff)
downloaddjango-3f60a8e98d90c1fce40017a2e01b0b4643d91bd6.tar.gz
[per-object-permissions] Fixed a bug where the RLP for an inline object would only be set when changing an object not adding
git-svn-id: http://code.djangoproject.com/svn/django/branches/per-object-permissions@3896 bcc190cf-cafb-0310-a4f2-bffc1f526a37
-rw-r--r--django/db/models/manipulators.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/django/db/models/manipulators.py b/django/db/models/manipulators.py
index bfdc3ef6de..78a95dbc17 100644
--- a/django/db/models/manipulators.py
+++ b/django/db/models/manipulators.py
@@ -130,6 +130,7 @@ class AutomaticManipulator(forms.Manipulator):
expanded_data = DotExpandedDict(dict(new_data))
self.new_rel_objs = []
+
# Save many-to-one objects. Example: Add the Choice objects for a Poll.
for related in self.opts.get_all_related_objects():
# Create obj_list, which is a DotExpandedDict such as this:
@@ -208,12 +209,14 @@ class AutomaticManipulator(forms.Manipulator):
if self.change:
if not old_rel_obj: # This object didn't exist before.
self.fields_added.append('%s "%s"' % (related.opts.verbose_name, new_rel_obj))
- self.new_rel_objs.append(new_rel_obj)
else:
for f in related.opts.fields:
if not f.primary_key and f != related.field and str(getattr(old_rel_obj, f.attname)) != str(getattr(new_rel_obj, f.attname)):
self.fields_changed.append('%s for %s "%s"' % (f.verbose_name, related.opts.verbose_name, new_rel_obj))
-
+
+ if not old_rel_obj:
+ self.new_rel_objs.append(new_rel_obj)
+
# Save many-to-many objects.
for f in related.opts.many_to_many:
if child_follow.get(f.name, None) and not f.rel.edit_inline: