#4653: form_for_instance generates empty choice for non-blank CharField with
options
------------------------------------------------------------------------+---
Reporter: Ilya Semenov <[EMAIL PROTECTED]> |
Owner: adrian
Status: new |
Component: django.newforms
Version: SVN |
Resolution:
Keywords: form_for_instance form_for_model CharField options blank |
Stage: Design decision needed
Has_patch: 1 |
Needs_docs: 0
Needs_tests: 0 |
Needs_better_patch: 1
------------------------------------------------------------------------+---
Changes (by Ilya Semenov <[EMAIL PROTECTED]>):
* stage: Unreviewed => Design decision needed
Comment:
The rationale behind my proposal is that according to the model contract,
you can't **change** the value to be empty. By offering users the
possibility to **change** the selection to "--------", we're misleading
them. For example, see the "Component:" selector on Trac comments form
below. There's no "empty" choice, since it wouldn't make sense.
If there was a good way to remove the blank values without changing the
django core, I probably wouldn't post the ticket.
What I found is to directly access Form.base_fields[xxx].widget.options
for each field, or write a custom formfield processor. Both ways feel a
bit clumsy.
--
Ticket URL: <http://code.djangoproject.com/ticket/4653#comment:4>
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
-~----------~----~----~----~------~----~------~--~---