17.6 Forgoing GCBVs

One of the most difficult tasks when working with GCBV is knowing when and when not to use a GCBV. For instance, we’ve left NewsLinkDelete, NewsLinkUpdate, PostDelete, and PostUpdate alone and have not touched the view in the contact app. Our post_detail view isn’t even a class (yet). This is not an accident! Django does not supply generic behavior for these views.

We could replace the current incarnations of NewsLinkDelete and NewsLinkUpdate, but we’re waiting to replace these views in favor of views that use NewsLink’s new SlugField. Our NewsLink model is unique according to the startup and to the slug, meaning we would need a view that uses both of those fields to fetch the data. However, Django’s GCBVs only work with ...

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.