Django

Code

Ticket #3401 (closed: duplicate)

Opened 2 years ago

Last modified 2 years ago

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

Reported by: anton@khalikov.ru Assigned to: adrian
Milestone: Component: Forms
Version: SVN Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

char_field_with_choices.patch (1.0 kB) - added by anton@khalikov.ru on 01/30/07 05:37:36.
patch that fixes the issue

Change History

01/30/07 05:37:36 changed by anton@khalikov.ru

  • attachment char_field_with_choices.patch added.

patch that fixes the issue

01/30/07 06:02:04 changed by anton@khalikov.ru

  • needs_better_patch changed.
  • needs_tests changed.
  • needs_docs changed.

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.

01/30/07 08:17:49 changed by mir@noris.de

isn't this the same as #3268?

01/30/07 09:50:01 changed by Gary Wilson <gary.wilson@gmail.com>

  • status changed from new to closed.
  • resolution set to duplicate.

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


Add/Change #3401 ([patch] newforms: models.CharField with choices should be displayed as forms.ChoiceField according to oldforms behavior)




Change Properties
Action