Views can be Classy!
Audience level
Intermediate
Category
How To/Intro
Time
September 4th, 1:30 p.m. – 2:10 p.m.
Description
An overview of what class-based views (CBVs) are, which ones are available, and how to use them in your projects. I'll also cover creating mixins, where function-based views still make sense, and how to test CBVs. As part of this, I'll be covering my django-braces (https://crate.io/packages/django-braces/) package.
Abstract
It seems like most people in the Django community either don't have any idea how class-based views work or are scared to try them out. I want to help with a solid introduction to the technology.
- The usual "who I am" bit.
- Most other things in Django are classes.
-
- models
-
- forms
-
- even templates
- Views should be classes, too.
- What view classes are provided by Django.
- How to create your own mixins to clean up pain points
- Where function-based views are still handy.
- Example CBVs for common use cases
-
- handling form input for more than one form
-
- serving different content based on users