Opened 9 years ago

Closed 9 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
Component: Forms Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

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@… 9 years ago.
patch that fixes the issue

Download all attachments as: .zip

Change History (4)

Changed 9 years ago by anton@…

patch that fixes the issue

comment:1 Changed 9 years ago by anton@…

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 Changed 9 years ago by mir@…

isn't this the same as #3268?

comment:3 Changed 9 years ago by Gary Wilson <gary.wilson@…>

  • Resolution set to duplicate
  • Status changed from new to closed

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