Skip to content

Commit

Permalink
Fixes #1816, #2243 -- Removed a stale remnant of pre-magic removal co…
Browse files Browse the repository at this point in the history
…de in manipulators that modify m2m object that are edited inline. Thanks to dolemite@wuli.nu and coconutstudio@yahoo.com for the original reports, Tyson Tate for a clean test case, and Jay Parlar for helping out with a solution.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3830 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
freakboy3742 committed Sep 25, 2006
1 parent a64cb2e commit 1753376
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions django/db/models/manipulators.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def save(self, new_data):
# TODO: Add to 'fields_changed' # TODO: Add to 'fields_changed'


expanded_data = DotExpandedDict(dict(new_data)) expanded_data = DotExpandedDict(dict(new_data))
print expanded_data
# Save many-to-one objects. Example: Add the Choice objects for a Poll. # Save many-to-one objects. Example: Add the Choice objects for a Poll.
for related in self.opts.get_all_related_objects(): for related in self.opts.get_all_related_objects():
# Create obj_list, which is a DotExpandedDict such as this: # Create obj_list, which is a DotExpandedDict such as this:
Expand Down Expand Up @@ -215,8 +216,9 @@ def save(self, new_data):
# Save many-to-many objects. # Save many-to-many objects.
for f in related.opts.many_to_many: for f in related.opts.many_to_many:
if child_follow.get(f.name, None) and not f.rel.edit_inline: if child_follow.get(f.name, None) and not f.rel.edit_inline:
was_changed = getattr(new_rel_obj, 'set_%s' % f.name)(rel_new_data[f.attname]) print 'rel_new_data:',rel_new_data
if self.change and was_changed: setattr(new_rel_obj, f.name, f.rel.to.objects.filter(pk__in=rel_new_data[f.attname]))
if self.change:
self.fields_changed.append('%s for %s "%s"' % (f.verbose_name, related.opts.verbose_name, new_rel_obj)) self.fields_changed.append('%s for %s "%s"' % (f.verbose_name, related.opts.verbose_name, new_rel_obj))


# If, in the change stage, all of the core fields were blank and # If, in the change stage, all of the core fields were blank and
Expand Down

0 comments on commit 1753376

Please sign in to comment.