magic-removal: Fixed #1331 - flatten_data method of ManyToManyField now

updated for descriptor changes.  Thanks, Tom Tobin.


git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2281 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Luke Plant 2006-02-06 12:47:25 +00:00
parent e8017bb5c0
commit a19915e7ea
1 changed files with 1 additions and 2 deletions

View File

@ -409,8 +409,7 @@ class ManyToManyField(RelatedField, Field):
def flatten_data(self, follow, obj = None): def flatten_data(self, follow, obj = None):
new_data = {} new_data = {}
if obj: if obj:
get_list_func = getattr(obj, 'get_%s_list' % self.rel.singular) instance_ids = [instance._get_pk_val() for instance in getattr(obj, self.name).all()]
instance_ids = [instance._get_pk_val() for instance in get_list_func()]
if self.rel.raw_id_admin: if self.rel.raw_id_admin:
new_data[self.name] = ",".join([str(id) for id in instance_ids]) new_data[self.name] = ",".join([str(id) for id in instance_ids])
else: else: