mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Fixed #26020 -- Normalized header stylings in docs.
This commit is contained in:
parent
79d0a4fdb0
commit
bca9faae95
132 changed files with 1498 additions and 1464 deletions
|
@ -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::
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue