Added note to docs/form_for_model.txt (from [6844]) explaining this is deprecated in favor of ModelForms

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6944 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2007-12-19 03:39:21 +00:00
parent ac3885c433
commit 81b9b7fb55
2 changed files with 9 additions and 2 deletions

View File

@ -1,6 +1,13 @@
Generating forms for models Generating forms for models
=========================== ===========================
.. admonition:: Note
The APIs described in this document have been deprecated. If you're
developing new code, use `ModelForms`_ instead.
.. _ModelForms: ../modelforms/
If you're building a database-driven app, chances are you'll have forms that If you're building a database-driven app, chances are you'll have forms that
map closely to Django models. For instance, you might have a ``BlogComment`` map closely to Django models. For instance, you might have a ``BlogComment``
model, and you want to create a form that lets people submit comments. In this model, and you want to create a form that lets people submit comments. In this

View File

@ -277,7 +277,7 @@ model fields:
any attempt to ``save()`` a ``ModelForm`` with missing fields will fail. any attempt to ``save()`` a ``ModelForm`` with missing fields will fail.
To avoid this failure, you must instantiate your model with initial values To avoid this failure, you must instantiate your model with initial values
for the missing, but required fields, or use ``save(commit=False)`` and for the missing, but required fields, or use ``save(commit=False)`` and
manually set anyextra required fields:: manually set any extra required fields::
instance = Instance(required_field='value') instance = Instance(required_field='value')
form = InstanceForm(request.POST, instance=instance) form = InstanceForm(request.POST, instance=instance)
@ -296,7 +296,7 @@ Overriding the default field types
---------------------------------- ----------------------------------
The default field types, as described in the "Field types" table above, are The default field types, as described in the "Field types" table above, are
sensible defaults; if you have a ``DateField`` in your model, chances are you'd sensible defaults. If you have a ``DateField`` in your model, chances are you'd
want that to be represented as a ``DateField`` in your form. But want that to be represented as a ``DateField`` in your form. But
``ModelForm`` gives you the flexibility of changing the form field type ``ModelForm`` gives you the flexibility of changing the form field type
for a given model field. You do this by declaratively specifying fields like for a given model field. You do this by declaratively specifying fields like