30.3.3 Starting with Generic Views

If we had started our site with generic class-based views (GCBVs), this book would have been much, much shorter (and far more opaque). When building a view, use Django’s documentation and https://ccbv.co.uk/ and ask yourself: Does a GCBV already provide the majority of the behavior I want? If the answer is yes, then you should definitely use a GCBV.

In the event the answer is no, then you are left with the choice of building a view with a class-based view (CBV) or else a function view (FV). In the event you need reusable behavior, you should absolutely use a CBV, as it affords you all of the power of object-oriented programming. However, if you don’t need reusable behavior, you are still left with the choice ...

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.