On Mon, Jul 4, 2011 at 11:46 AM, Szabo, Patrick (LNG-VIE)
<patrick.sz...@lexisnexis.at> wrote:
> I was afraid somethig like that would come.
> I did read the doc but i don't really understand it :-(
> Could you plz make it a little clearer for me  ?!
>

You are using a model form. The model form has a model selection in
it. You want the select to have different labels.

Labels on a model selection field come from the __unicode__ method of
the model, or from the label_from_instance of the model field class.

Model forms allow you to specify the classes to use for each model attribute.

Hence:

Define a new class derived from ModelChoiceField (not called ModelChoiceField).
Add a label_from_instance method to the new class
Configure your ModelForm to use this new field instead of ModelChoiceField

All of this is explained in the docs. Read the docs.

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to