17.5.5 Overriding Methods (in NewsLinkDelete
)
In Chapter 18, we’ll change the URL pattern for NewsLinkUpdate
and NewsLinkDelete
to use NewsLink
’s new SlugField
. For now, we keep the URL pattern as is. This allows for the demonstration of a GCBV that uses pk
instead of a SlugField
(see next chapter), as well as a GCBV that requires a method to be overridden (right now!).
In most cases, GCBVs can be subclassed by overriding only attributes. However, for some, method overrides are mandatory. GCBV functionality is split up according to behavior (similar to how we split our custom DetailView
in Section 17.2.3), making method overrides almost as straightforward as attribute overrides.
In StartupDelete
and TagDelete
, we were able to set the success_url ...
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.