Ticket #1012: coremeta.diff
File coremeta.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 print foo 1801 if type(foo) == types.ListType: 1802 new_vals.append(foo[0]) 1803 1804 else: 1805 new_vals.append(foo) 1794 1806 was_changed = getattr(new_object, 'set_%s' % f.name)(new_vals) 1795 1807 if change and was_changed: 1796 1808 self.fields_changed.append(f.verbose_name)