-
Notifications
You must be signed in to change notification settings - Fork 301
Documentation: ORM-Less View Examples #777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Of what type is result? And as this is a get request shouldn't you access I haven't done this before but technically I think it should be possible to use APIView. Such view needs to return data of a serializer though ( |
@sliverc I'm so sorry I missed your response! You were correct about the GET. Postman happily sends GET requests with JSON bodies and Django happily parses them, but that's not the standard so I have switched to GET params. I was able to implement a model-less serializer by extending I'm now looking into getting pagination and filtering working. I'm guessing since I am in control of the model entirely I'm going to have to roll my own pagination and filtering, which is fine. Just looking at the DJA source to figure out how to do this since I'm having trouble finding examples. Feel free to close this, thanks very much, and sorry about the delay! |
Hi @Rjak, just to share that I've tried to implement a model-less DJA view. The pagination can be enabled by inserting a list of objects into
According to DRF, the It's not a future-proof solution, as any future change to |
I am working on both a personal project and a project for work which retrieves data from external sources, not from an ORM.
My personal project has a class-based view like this:
When I enable DJA, I get the following response to this query:
It's not clear to me what this error message refers to. Is there a problem with the request body I am submitting? The search term is specified in a request body (I'm not using filtering here because my understanding is that filters are tied to querysets and since the data is coming from an external API and not an ORM it is not applicable).
The only examples I can find are bound to ORM usage, so I'm finding it tough to even examine the problem.
An example which shows custom logic for handling a string match search against an external, non-ORM data source would help me in this case.
Thanks very much!
The text was updated successfully, but these errors were encountered: