Ticket #1331: magic_removal-manytomany_flatten_data_fix.diff

File magic_removal-manytomany_flatten_data_fix.diff, 709 bytes (added by Tom Tobin <korpios@…>, 19 years ago)

fixes flatten_data method of ManyToManyField in magic-removal

  • db/models/fields/related.py

     
    409409    def flatten_data(self, follow, obj = None):
    410410        new_data = {}
    411411        if obj:
    412             get_list_func = getattr(obj, 'get_%s_list' % self.rel.singular)
    413             instance_ids = [instance._get_pk_val() for instance in get_list_func()]
     412            instance_ids = [instance._get_pk_val() for instance in getattr(obj, self.name).all()]
    414413            if self.rel.raw_id_admin:
    415414                 new_data[self.name] = ",".join([str(id) for id in instance_ids])
    416415            else:
Back to Top