August 2, 2021

Blog Easylearning Guru

Discover e-Learning

Implementing MTV model in Python Django

Implementing MTV model in Python Django

Python is a programming language which can be used for different tasks like program scripting, database programming, etc. On the other hand, Django is a web framework used to build website with numerous webpages, coded in Python.

Web framework is the framework for creating webpages. Each framework follows an M-V-C architecture pattern for building website to separate the data with business rules from the user interface. In Django web development, MVC is renamed as MTV. MTV is similar to MVC, but the difference lies in their recognition. In Django, MTV pattern stands

Specifically, Django’s Model is the data access layer containing everything about data. Django’s Template is the presentation layer containing all presentation related decisions. And, Django’s View is the business logic layer containing logic that access the model and refers to the appropriate template.

Django Template

Concluding the whole concept, we can say, in MTV, a request to a URL is dispatched to a view. This view calls into the Model, performs the manipulation and prepares the data for output. The data is passed to a Template that is rendered and emitted as a response.