Search This Blog

Usage of Class-Based Views - Python

 

Usage of Class-Based Views

Django's class-based views can be used:

  • Directly used in URLconf, when the view is not modified.
urlpatterns = [
    path('readme/', TemplateView.as_view(template_name="readme.html")),
]
  • As Generic views that
    • Inherits from a view and the corresponding attributes or methods can be modified.
    • Abstract common text phrases and patterns to write common views for reusability.
    • Can be used for display purposes or editing purposes.

In the next topics, you will look at some of the generic views in detail.

No comments:

Post a Comment

If you have any doubts, Please let us know.