DEV Community

Rob McBryde
Rob McBryde

Posted on

Django Views

As of the day I write this post, Django supports 3 ways to create a view:

  • function-based
  • class-based
  • generic class-based

Most problems you are trying to solve have probably already been done via a generic class based view. If it hasn't it is often possible to modify one of the generic views to suit your needs.

This will be my default approach to always utilise a generic class based view. Failing that I will fall back to creating a class-based view, then a function-based view.

For further learnings on this topic, check out the very useful Classy Class-Based Views site.

Top comments (0)