I'm trying to use TastyPie Patch
to a many-to-many, but I get this error:
"error_message": "Tastypie requires a Python-style path () to lazy load related resources. Only given 'SchemeResource'.",
Why?
The patch I'm making:
/participant/84
POST: {"email":"test@test.com", "schemes":{"id":"12", "schemes"}}
Resource:
class ParticipantResource(ModelResource):
schemes = fields.ToManyField('SchemeResource', attribute='schemes', full=True, null=True)
class Meta:
queryset = Participant.objects.all()
resource_name = 'participant'
allowed_methods = ['post', 'get', 'put', 'patch']
2nd Resource:
class SchemeResource(ModelResource):
user = fields.ToOneField(UserResource, 'user', full=True)
link = fields.ToOneField(SchemeLinkResource, 'link', full=True)
class Meta:
queryset = Scheme.objects.all()
resource_name = 'scheme'
Model:
class Participant(models.Model):
email = models.EmailField(unique=True)
mobile = PhoneNumberField(null=True, blank=True)
date_joined = models.DateTimeField(_('date joined'), default=timezone.now)
schemes = models.ManyToManyField(Scheme)