November 2015
Beginner to intermediate
840 pages
26h 30m
English
Post Objects in a View with PostFormLet’s use our view for creating Post objects to review what we learned in the last section.
Our PostCreate will implement get() to handle state one of Table 9.9, a reprint of our finite-state machine for views that create objects using Django forms. States 2 and 3 will be handled by the post() method.
Table 9.9: View States
As in TagCreate, we use class attributes to keep elements used in both views easily accessible in a single place, as shown in Example 9.25.
Example 9.25: Project Code
1 from django.shortcuts import ( 2 get_object_or_404, ...
Read now
Unlock full access