I implement it in the rest-framework project and I need tips for understanding it more.
It is clear that the rest-framework is necessary for building an API and working with external consumers (developers, other services). But wonders whether it is possible to use the data that the framework gives for internal interactions.
For example, before rest implementation, object detailing is available at the link:
element/<element_id> which corresponds to the view:
class ElementDetailView(DetailView): model = Element template = "element-detail.html" .... <какие-то переопределенные методы родителя> after rest implementation, object data is also available by reference.
api/v1/element/<element_id> and actually the question is, can parts of my project exchange data using the rest-framework?
For example, if I want to implement ajax-loading of object data, I will add the following code somewhere in the view:
class ElementDetailView(DetailView): model = Element template = "element-detail.html" .... <какие-то переопределенные методы родителя> .... if request.is_ajax(): return json-object accordingly, the url in the script will refer to this view, and the resulting data will be processed by the script.
but in the case of the rest-framework, can I use the url from rest-api in the script?
api/v1/element/<element_id> will it be right? or for internal interactions use only internal classes and functions, and rest only for external interactions?