Django

Code

Show
Ignore:
Timestamp:
08/05/08 12:15:33 (5 months ago)
Author:
jbronn
Message:

gis: Merged revisions 7981-8001,8003-8011,8013-8033,8035-8036,8038-8039,8041-8063,8065-8076,8078-8139,8141-8154,8156-8214 via svnmerge from trunk.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/gis

    • Property svnmerge-integrated changed from /django/trunk:1-7978 to /django/trunk:1-8214
  • django/branches/gis/docs/form_for_model.txt

    r7354 r8215  
    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()``?