Okay I'll try do tot hat...thank's a lot.
I already have this in my model for "Produkte" which holds the FK for that drop 
down:

def __unicode__(self):
        if self.Auflage:
            return "%s %s" % (self.Titel, self.Auflage)
        else:
            return self.Titel

So shouldn't this alreay be enough ?!


. . . . . . . . . . . . . . . . . . . . . . . . . .
Patrick Szabo
 XSLT Developer 
LexisNexis
Marxergasse 25, 1030 Wien

mailto:patrick.sz...@lexisnexis.at
Tel.: 00431 534521573 
Fax: +43 (1) 534 52 - 146 


-----Ursprüngliche Nachricht-----

Von: django-users@googlegroups.com [mailto:django-users@googlegroups.com] Im 
Auftrag von Tom Evans
Gesendet: Montag, 04. Juli 2011 13:10
An: django-users@googlegroups.com
Betreff: Re: change values in "select list"

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.



-- 
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