Ticket #5364: 5364.4.diff

File 5364.4.diff, 1.2 KB (added by Philippe Raoult, 17 years ago)

one more typo :)

  • docs/newforms.txt

     
    18731873.. note::
    18741874
    18751875    If you specify ``fields`` when creating a form with ``form_for_model()``,
    1876     make sure that the fields that are *not* specified can provide default
    1877     values, or are allowed to have a value of ``None``. If a field isn't
    1878     specified on a form, the object created from the form can't provide
    1879     a value for that attribute, which will prevent the new instance from
    1880     being saved.
     1876    then the fields that are *not* specified will not be set by the form's ``save()``
     1877    method. If any of those fields requires an explicit value ``save()`` will fail.
     1878    In that case you can call ``form.save(commit=False)`` to get an instance
     1879    with only the fields from the form which you can update yourself before saving::
     1880           
     1881            instance = form.save(commit=False)
     1882            instance.required_field = 'my_value'
     1883            instance.save()
    18811884
     1885    Be advised that the above will not allow saving of ManyToMany data to the altered
     1886    instance using ``form.save_m2m()``.
     1887   
    18821888Overriding the default field types
    18831889~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    18841890
Back to Top