Opened 17 years ago

Closed 17 years ago

#3401 closed (duplicate)

[patch] newforms: models.CharField with choices should be displayed as forms.ChoiceField according to oldforms behavior

Reported by: anton@… Owned by: Adrian Holovaty
Component: Forms Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Hello Adrian

With oldforms any model.CharField(..., choices=(...)) is displayed as <select ...> ...choices...</select>

In newforms this feature seem to be unimplemented yet and model.CharField is always displayed as forms.CharField. This behavior is unexpected. Attached patch fixes this.

Attachments (1)

char_field_with_choices.patch (1016 bytes ) - added by anton@… 17 years ago.
patch that fixes the issue

Download all attachments as: .zip

Change History (4)

by anton@…, 17 years ago

patch that fixes the issue

comment:1 by anton@…, 17 years ago

P.S. I DO know that it can be also done manually through callback function to form_to_model/form_to_instance calls, but it seems to be not right in this situation because if I always need to specify callback_func, there's no reason to me to specify choices=() in the model.

comment:2 by mir@…, 17 years ago

isn't this the same as #3268?

comment:3 by Gary Wilson <gary.wilson@…>, 17 years ago

Resolution: duplicate
Status: newclosed

marking a duplicate of #3268 and have made a note there about the patch attached here.

Note: See TracTickets for help on using tickets.
Back to Top