add text to the choice_label of ChoiceField in Django

Posted by pablo on Stack Overflow See other posts from Stack Overflow or by pablo
Published on 2010-06-12T11:37:33Z Indexed on 2010/06/12 11:42 UTC
Read the original article Hit count: 346

Filed under:
|

The ChoiceField creates a select html element and the options show the choice_label which is the _unicode_ of each model object.

How can I change the text of the choice_label without modifying _unicode_ ?

I have a Product model and I want to show in the options text the product name + price + link to edit.

I've searched in fields.py and widgets.py but couldn't find what needed to be changed.

Thanks

© Stack Overflow or respective owner

Related posts about django

Related posts about widget