-
Notifications
You must be signed in to change notification settings - Fork 299
Closed
@zacid
Description
Hi there,
I am using rest_framework_ember and am at the point where I'd like to start side loading resources.
I am using viewsets to setup my resource endpoints:
class DocumentViewSet(viewsets.ModelViewSet): """ API endpoint that allows users to be viewed or edited. """ queryset = Document.objects.all() serializer_class = DocumentSerializer class ContactViewSet(viewsets.ModelViewSet): """ API endpoint that allows users to be viewed or edited. """ queryset = Contact.objects.all() serializer_class = ContactSerializer
A document model has a relationship with a contact model so in order to sideload this data I'd have to somehow get something like this:
{ "document": { "id": 1, "title": "This is a document", "contacts": [1, 2] }, "contacts": [{ "id": 1, "first_name": "my name" }, { "id": 2, "first_name": "your name" }] }
Can this be accomplished using rest_framework_ember? I saw that there is a section in the readme about side loading relationships but it didn't exactly makes sense when it comes to my problem.
Any help in this regard would be greatly appreciated.
Thanks!
Metadata
Metadata
Assignees
Labels
No labels