[Answer]-Tastypie – Remove m2m inside another m2m

0👍

Just add the use_in='list' to the subcategories in Category

class CategoryResource(ModelResource):
  subcategories = fields.ToManyField(SubcategoryResource, 'subcategory_set', 'subcategories', full=True, use_in='list')

  class Meta:
    queryset = Category.objects.all()

1👍

Depending on the level of detail you’d like included when listing you can try setting full_list=False on the categories relationship or using full_list and full_detail on the subcategories to alter the output.

http://django-tastypie.readthedocs.org/en/latest/fields.html#tastypie.fields.RelatedField.full_list

Leave a comment