Ticket #1816: manipulators.py.diff
File manipulators.py.diff, 1.2 KB (added by , 19 years ago) |
---|
-
manipulators.py
215 215 # Save many-to-many objects. 216 216 for f in related.opts.many_to_many: 217 217 if child_follow.get(f.name, None) and not f.rel.edit_inline: 218 was_changed = getattr(new_rel_obj, 'set_%s' % f.name)(rel_new_data[f.attname]) 218 # First, clear the existing values. 219 rel_manager = getattr(new_rel_obj, f.name) 220 rel_manager.clear() 221 # Then, set the new values. 222 for n in rel_new_data[f.attname]: 223 rel_manager.add(f.rel.to._default_manager.get(pk=n)) 224 225 was_changed = True 219 226 if self.change and was_changed: 220 227 self.fields_changed.append('%s for %s "%s"' % (f.verbose_name, related.opts.verbose_name, new_rel_obj)) 221 228