#3268: [patch] form_for_model() should use ChoiceField for any DB field with
"choices" set
---------------------------------------+------------------------------------
Reporter: [EMAIL PROTECTED] | Owner: adrian
Status: new | Component: django.newforms
Version: SVN | Resolution:
Keywords: | Stage: Accepted
Has_patch: 1 | Needs_docs: 0
Needs_tests: 0 | Needs_better_patch: 0
---------------------------------------+------------------------------------
Changes (by mrmachine):
* needs_tests: 1 => 0
Comment:
the last two patches were made out of date by recent changes to
django/db/models/fields/__init__.py, so i've re-implemented this
functionality by creating an appropriate Select widget (which can still be
overridden if a custom widget is passed in directly) for any form fields
that have choices.
i left the implementation in django/db/models/fields/__init__.py so that
it would be useful for anyone wanting to return a form field from a model
field, not only when generating a form object with the form_for_* methods.
i also updated tests/modeltests/model_forms/models.py by adding an integer
field with choices to the models, updating the expected output, and a
comment explaining that any fields with choices defined in the model are
represented by a select list (same as foreignkeys).
--
Ticket URL: <http://code.djangoproject.com/ticket/3268#comment:10>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---