Django Interview Questions and Answers
Question: What are view functions? Can you directly import a function within the URL?Answer:A view is a middle layer between a model and a template, and it will take the data from the model and pass it to a template. Every application in Django has the view.py file that stores view functions, and these functions take the argument and return the browser-renderable format. You can easily import view functions in the URL file. To do so, you need to import the view function in the urls.py file and add the desired path required by the browser to call that function. |
Is it helpful?
Yes
No
Most helpful rated by users:
- What are the different applications of Django?
- What are view functions? Can you directly import a function within the URL?
- What is a model in Django?