Django

Code

Show
Ignore:
Timestamp:
07/21/08 11:38:54 (5 months ago)
Author:
gwilson
Message:

Refs #7864 -- Updates to documentation for the oldforms/newforms switch.

  • Moved forms.txt to oldforms.txt
  • Moved newforms.txt to forms.txt
  • Updated links and most references to "newforms" (there are a few sections that need a more significant rewrite).
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/docs/form_for_model.txt

    r7294 r8020  
    2121-------------------- 
    2222 
    23 The method ``django.newforms.form_for_model()`` creates a form based on the 
     23The method ``django.forms.form_for_model()`` creates a form based on the 
    2424definition of a specific model. Pass it the model class, and it will return a 
    2525``Form`` class that contains a form field for each model field. 
     
    2727For example:: 
    2828 
    29     >>> from django.newforms import form_for_model 
     29    >>> from django.forms import form_for_model 
    3030 
    3131    # Create the form class. 
     
    9494types are special cases: 
    9595 
    96     * ``ForeignKey`` is represented by ``django.newforms.ModelChoiceField``, 
     96    * ``ForeignKey`` is represented by ``django.forms.ModelChoiceField``, 
    9797      which is a ``ChoiceField`` whose choices are a model ``QuerySet``. 
    9898 
    9999    * ``ManyToManyField`` is represented by 
    100       ``django.newforms.ModelMultipleChoiceField``, which is a 
     100      ``django.forms.ModelMultipleChoiceField``, which is a 
    101101      ``MultipleChoiceField`` whose choices are a model ``QuerySet``. 
    102102 
     
    229229 
    230230If you want to add custom methods to the form generated by 
    231 ``form_for_model()``, write a class that extends ``django.newforms.BaseForm`` 
     231``form_for_model()``, write a class that extends ``django.forms.BaseForm`` 
    232232and contains your custom methods. Then, use the ``form`` argument to 
    233233``form_for_model()`` to tell it to use your custom form as its base class. 
     
    413413form field. 
    414414 
    415 .. _contact form: ../newforms/#simple-view-example 
    416 .. _`simple example view`: ../newforms/#simple-view-example 
     415.. _contact form: ../forms/#simple-view-example 
     416.. _`simple example view`: ../forms/#simple-view-example 
    417417 
    418418When should you use ``form_for_model()`` and ``form_for_instance()``?