Class Based View

Docsarrow-up-right

Class Based View

  • Class that creates View functions

  • There are differences & advantages compared to function-based-view!

    • HTTP methods like GET, POST requests can be expressed as individual methods rather than conditional branching

      HTTP methods have 1:1 correspondence with class methods, so readability is good

  • Excellent extensibility

    • Can maximize extensibility by utilizing Mixin modules

      • Mixin: Module for adding additional functionality or information to classes

  • Can maintain code intuitiveness even with complex logic

Function generic view vs class based generic view

Function generic view

ex)

class based generic view

ex)

views.py

urls.py

+

Django REST API Auth

https://django-rest-auth.readthedocs.io/en/latest/installation.htmlarrow-up-right

Last updated