recursive models endpoints structure #7920
Unanswered
aryaniyaps
asked this question in
Question & Answer
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have three models like this (Simplified).
as you can see, the structure is recursive.
Ideally, from the frontend, I would want to make a single request to return all the files and folders the
locker has at the root level (parent is None). Then, I would also like to make requests to get all the files and folders inside of a specified folder ( when the user opens a folder at the frontend).
I am using Django Rest Framework right now.
However, I cannot think of a way to achieve this because I would have to serialize two models into one view (I also want support for pagination). How can this be implemented in the simplest way?
Can someone please help me?
Thanks a lot in advance!
relevant Stack Overflow question is here.
Edit
I can imagine the endpoints structure to be like this.
Beta Was this translation helpful? Give feedback.
All reactions