17.8 Putting It All Together

Generic class-based views (GCBVs) are class-based views (CBVs) that come with predefined behavior. For this behavior to work correctly, existing attributes on the class must be overridden. Without these overrides, a GCBV will not function.

The major difficulty with GCBVs is the amount of content and overhead there is to learning them. Once understood, they become one of Django’s most useful features, as they allow developers to create views quickly and efficiently. It would be silly to try to write your own classes with these behaviors when you can use code that is publicly reviewed and has been in use since 2011 (Django 1.3’s release).

The biggest mistake I see beginners make with GCBVs is the attempt to use them ...

Get Django Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.