Ticket #1012: coremeta2.diff
File coremeta2.diff, 1.4 KB (added by , 19 years ago) |
---|
-
django/trunk/django/core/meta/__init__.py
1784 1784 self.fields_changed.append(f.verbose_name) 1785 1785 1786 1786 # Save many-to-many objects. Example: Poll.set_sites() 1787 import types 1787 1788 for f in opts.many_to_many: 1788 1789 if self.follow.get(f.name, None): 1789 1790 if not f.rel.edit_inline: 1790 if f.rel.raw_id_admin: 1791 new_vals = new_data.get(f.name, ()) 1792 else: 1793 new_vals = new_data.getlist(f.name) 1791 new_vals = [] 1792 try: 1793 data = dict.__getitem__(new_data, f.name) 1794 except: 1795 data = [] 1796 if type(data) == types.ListType and len(data) == 1 and \ 1797 type(data[0]) == types.ListType: 1798 data = data[0] 1799 for foo in data: 1800 if type(foo) == types.ListType: 1801 new_vals.append(foo[0]) 1802 1803 else: 1804 new_vals.append(foo) 1794 1805 was_changed = getattr(new_object, 'set_%s' % f.name)(new_vals) 1795 1806 if change and was_changed: 1796 1807 self.fields_changed.append(f.verbose_name)