Answer the question
In order to leave comments, you need to log in
What are the capabilities of views in Django and is it possible to use python code in them?
I am learning Django and I have a question. One way or another, everything in the tutorials is tied to data models, views, urls, etc. How can I use arbitrary code in django, for example in the same view page? Is there something similar to inserts like in jsp or php?
Answer the question
In order to leave comments, you need to log in
Django is an MVC model (Model-View-Controller)
View is templates, page template.
Controller is executable code, here you can write whatever you want in python and prepare all the necessary data to be displayed in View.
This approach allows the programmer to do his own thing, and the designer / layout designer to do his own.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question