17.4 Building Generic Object Create Pages
In this section, we transform ObjectCreateMixin
into a GCBV.
The ObjectCreateMixin
class already provides get()
and post()
methods, which TagCreate
, StartupCreate
, and NewslinkCreate
all inherit in tandem with View
to be full-fledged CBVs. To turn ObjectCreateMixin
into it’s own CBV, we can first rename it to CreateView
and then make it inherit View
, as shown in Example 17.22.
organizer/utils.py
in 6b1f610347
7 class CreateView(View):
We must thus inherit the new GCBV in the relevant create views, as shown in Example 17.23.
organizer/views.py
in 6b1f610347
12 from .utils import ( 13 CreateView, ObjectDeleteMixin, ...
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.