Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed #3922 -- Added a warning that fields passed to form_for_model c…

…allback function should not be modified. It's bad for your health. Thanks, Philippe Raoult.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6148 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 62fe5cf138b406a2e478bd5a26b1227d1190e186 1 parent 1e94ef8
@malcolmt malcolmt authored
Showing with 12 additions and 0 deletions.
  1. +1 −0  AUTHORS
  2. +11 −0 docs/newforms.txt
View
1  AUTHORS
@@ -241,6 +241,7 @@ answer newbie questions, and generally made Django that much better:
Jan Rademaker
Michael Radziej <mir@noris.de>
Amit Ramon <amit.ramon@gmail.com>
+ Philippe Raoult <philippe.raoult@n2nsoft.com>
Massimiliano Ravelli <massimiliano.ravelli@gmail.com>
Brian Ray <http://brianray.chipy.org/>
remco@diji.biz
View
11 docs/newforms.txt
@@ -1916,6 +1916,17 @@ Note that your callback needs to handle *all* possible model field types, not
just the ones that you want to behave differently to the default. That's why
this example has an ``else`` clause that implements the default behavior.
+.. warning::
+ The field that is passed into the ``formfield_callback`` function in
+ ``form_for_model()`` and ``form_for_instance`` is the field instance from
+ your model's class. You **must not** alter that object at all; treat it
+ as read-only!
+
+ If you make any alterations to that object, it will affect any future
+ users of the model class, because you will have changed the field object
+ used to construct the class. This is almost certainly what you don't want
+ to have happen.
+
Finding the model associated with a form
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please sign in to comment.
Something went wrong with that request. Please try again.