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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access