Django TemplateView [Simple Example]
in this article we'll explore how to use templateView in django.
when you should use TemplateView
TemplateView should be used when you want to present some information in a html page. TemplateView shouldn't be used when your page has forms and does creation or update of objects. In such cases FormView, CreateView or UpdateView is a better option.
# app/views.py from django.views.generic import TemplateView class IndexView(TemplateView): template_name = "index.html" #your_template
#urls.py from django.urls import path from some_app.views import IndexView urlpatterns = [ path('index/', IndexView.as_view()), ]
English today is not an art to be mastered it's just a tool to use to get a result