Rectangle 27 0

Adding an item to a one_to_many relationship in django tastypie only works the 2nd time?

class ModelB(models.Model):
# Some fields
a = models.ForeignKey(ModelA, related_name='b_list')
class ResourceA(ModelResource):
b_list = fields.ToManyField('app.api.ResourceB', 'b_list', null=True)

Ok. This is a Django error. I'm not sure, try to use related_name in the django model.

Remove the related_name from the resource and the attribute name must change from 'a_set' to 'b_list'