Ticket #1334: manipulators.patch
File manipulators.patch, 1.4 KB (added by , 19 years ago) |
---|
-
fields/related.py
127 127 (rel_col_name, join_table, this_col_name, 128 128 rel_col_name, ",".join(['%s'] * len(new_ids))), 129 129 [this_pk_val] + list(new_ids)) 130 existing_ids = set([row[0] for row in cursor.fetchmany(rowcount)]) 130 if rowcount: 131 existing_ids = set([row[0] for row in cursor.fetchmany(rowcount)]) 132 else: 133 existing_ids = set() 131 134 132 135 # Add the ones that aren't there already 133 136 for obj_id in (new_ids - existing_ids): -
manipulators.py
119 119 new_vals = new_data.get(f.name, ()) 120 120 else: 121 121 new_vals = new_data.getlist(f.name) 122 was_changed = getattr(new_object, 'set_%s' % f.name)(new_vals) 122 # was_changed = getattr(new_object, 'set_%s' % f.name)(new_vals) 123 getattr(new_object, f.name).clear() 124 was_changed = getattr(new_object, f.name).add(*f.rel.to.objects.filter(id__in=new_vals)) 125 #chang end 123 126 if self.change and was_changed: 124 127 self.fields_changed.append(f.verbose_name) 125 128