What are Django’s view, serializer and model settings?

Asked

Viewed 227 times

0

I’m studying the 'Django' and would like to understand the definitions view, serialize and model and which route between them.

Thank you

1 answer

2


View

View in Django is the business logic layer. It is responsible for processing the user request and sending a valid response. It fetches the data from model, provides every model access to specific data for display or may perform some processing on the data beforehand. Currently, the views Django may be functions that process the request and return a response or classes.

Model

The model Django makes use of a powerful ORM layer that simplifies database and data processing and speeds up the development process.

Without the ORM(Object Relational mapper), developers would have to create their own tables and define the queries or procedures that sometimes translate into a large amount of SQL that is prone to be complex and difficult to track.

The ORM layer allows you to write all table settings in simple Python code, and takes care to translate it into the appropriate query language chosen, as well as facilitate CRUD operations. In fact, the developer doesn’t necessarily need to fully know the complex SQL or what it means, however, it’s worth noting that SQL would allow you to write better and faster queries and also make your site safer.

Serialize

Using Serializers, we can translate Django model objects into other formats like XML, JSON, YAML (YAML is not a markup language) that can be used in your views.

How does the flow of a request happen

The flow of a request follows Django’s MVT(Model, View and Template) model as a variation of the MVC(Model, View and Controller)

inserir a descrição da imagem aqui

Browser other questions tagged

You are not signed in. Login or sign up in order to post.