Create class based view in django 3

Hello World, Welcome to projects Today we will learn how to create a class-based view in Django 3. In this tutorial, we will render a simple template via class. Basically, there are two methods to load the view template in Django. One is a function-based view(FBV) and another is a class-based view(CBV). Class-based views were introduced in Django 1.7. The reason behind this was the proper structure, inheritance and the developer can customize the class-based view more than the function-based view.

  • Create cbv.html in the templates¬†folder in your app and add the following code.
  • <!DOCTYPE html>
    <html lang="en">
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>CBV View</title>
        <h3>Hello World, This is class based view</h3>


  • Open app/ and add the following code in it
  • urlpatterns=[


Leave a Reply

Your email address will not be published. Required fields are marked *