diff options
Diffstat (limited to 'docs/topics/class-based-views/generic-editing.txt')
| -rw-r--r-- | docs/topics/class-based-views/generic-editing.txt | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/docs/topics/class-based-views/generic-editing.txt b/docs/topics/class-based-views/generic-editing.txt index f5fa2ffcdb..0a1cd06961 100644 --- a/docs/topics/class-based-views/generic-editing.txt +++ b/docs/topics/class-based-views/generic-editing.txt @@ -1,3 +1,4 @@ +==================================== Form handling with class-based views ==================================== @@ -13,7 +14,7 @@ this, Django provides a collection of generic class-based views for form processing. Basic Forms ------------ +=========== Given a simple contact form: @@ -60,7 +61,7 @@ Notes: redirects to the :attr:`~django.views.generic.edit.FormMixin.success_url`. Model Forms ------------ +=========== Generic views really shine when working with models. These generic views will automatically create a :class:`~django.forms.ModelForm`, so long as @@ -180,7 +181,7 @@ Finally, we hook these new views into the URLconf: on your view class. Models and request.user ------------------------ +======================= To track the user that created an object using a :class:`CreateView`, you can use a custom :class:`~django.forms.ModelForm` to do this. First, add @@ -223,7 +224,7 @@ alternatively handle unauthorized users in the :meth:`~django.views.generic.edit.ModelFormMixin.form_valid()`. AJAX example ------------- +============ Here is a simple example showing how you might go about implementing a form that works for AJAX requests as well as 'normal' form POSTs:: |
