You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am new to Tastypie and I am trying to understand how to query relationships.
I read Creating more Resources. It is unclear for me what the second parameter 'user' really does in line user = fields.ForeignKey(UserResource, 'user'). I flicked to Relationship Fields and read it but I could not find any clue about it. I was expecting kind of a list of parameters with explanations 😕
That makes it even harder to understand the next step: many-to-many relationships.
The text was updated successfully, but these errors were encountered:
Relationship fields inherit parameters of basic API fields. In this case user is attribute parameter:
A string naming an instance attribute of the object wrapped by the Resource. The attribute will be accessed during the dehydrate or or written during the hydrate.
If your resource contains queryset = Note.objects.all(), user will be user field of Note model instance. It's very similar with m2m relationships.
I agree that documentation could be improved here. I'd say, let's keep this issue open and I'm sure it'll be fixed sooner or later.
I am new to Tastypie and I am trying to understand how to query relationships.
I read Creating more Resources. It is unclear for me what the second parameter
'user'
really does in lineuser = fields.ForeignKey(UserResource, 'user')
. I flicked to Relationship Fields and read it but I could not find any clue about it. I was expecting kind of a list of parameters with explanations 😕That makes it even harder to understand the next step: many-to-many relationships.
The text was updated successfully, but these errors were encountered: