My apologies if my choice of google search terms was poor and this is clearly documented somewhere. I have searched high and low and been unable to find a good answer on this:As I find myself building new views, I see a problem of duplication of code / logic:From a rendering efficiency standpoint on the web, it's better to render templates on the server side rather than render the page and rely on the browser to make an HTTP request to our API for that page. That's slower (you must wait until document.ready to even start) and adds more HTTP requests (not good for people on mobile networks, especially).
So what I end up with is a traditional django view / controller that's basically doing the same work that an API endpoint call would be doing. If I add a new sort/filter method to a list view, then, I need to sync up the changes I make in both the API and the django controller (say a new URL param is accepted or what have you).
It would be great if I could call a view internally, and instead of returning serialized data (e.g. JSON, etc) - I just got the same queryset. This way, I wouldn't be updating logic in two places with the possibility of forgetting / letting them get out of sync. Does this exist? I do see the docs for TemplateHTMLRenderer - that is close to what I want - but I want the result of a call there without making an HTTP request.
I did find this slight allusion to a similar request but it's quite old and seems to be a dead end:I would appreciate any input / insight, thanks!
--Steve
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-fram...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
| | Filipe Ximenes +55 (81) 8245-9204 Vinta Software Studio http://www.vinta.com.br |
--
You received this message because you are subscribed to a topic in the Google Groups "Django REST framework" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-rest-framework/26tIiJB7vQw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-rest-fram...@googlegroups.com.