Python

PYTHON-DJANGO MVT Pattern

PYTHON-DJANGO MVT Pattern

The MVT (Model View Template) is a software design pattern. It is a combination of Model, View and Template. The Model-View-Template (MVT) is slightly different from MVC. The main difference between the two patterns is that Django takes care of the Controller part. The template is an HTML file mixed with Django Template Language (DTL).

Django is referred to as an MTV framework. In MTV,

  • M – “Model,” the data access layer. This layer contains everything about the data: how to access it, how to validate it, which behaviors, it has, and the relationships between the data.
  • T – “Template,” the presentation layer. This layer defines how something should be displayed on a Web page .
  • V -“View,” the logic layer. This layer contains the logic that accesses the model and defers to the appropriate template.
PYTHON-DJANGO MVT Pattern Info Graphics

The diagram illustrates how each of the components of the MVT pattern interacts with each other to serve a user request. The developer provides the Model, the view and the template, then just maps it to a URL and Django does the magic to serve it to the user.

Author: STEPS

Leave a Reply

Your email address will not be published. Required fields are marked *