I followed Karen and TiNo's suggestion and added this to the Product
class:
def __unicode__(self):
return ("%s | %s") % (self.title, self.language)
It works. When listing products in classes that have "product" as a
ManyToManyField, it lists them in the select box, just as I wanted.
But
I know ModelAdmin accepts a list_select_related option, for in the admin
change list. I don't know if that applies in this situation though.
On Fri, Sep 12, 2008 at 8:10 PM, felix <[EMAIL PROTECTED]> wrote:
>
>
> now this will hit the database for each item in the select, to go
> fetch the
now this will hit the database for each item in the select, to go
fetch the language object to get the language name.
so for extra credit, where do we add a select_related() for the
widget ?
On Sep 12, 7:43 pm, TiNo <[EMAIL PROTECTED]> wrote:
> Probably more like:
> def __unicode__(self):
>
Probably more like:
def __unicode__(self):
return u'%s | %s' % (self.title, self.language.name)
because self.language is the language object, not the name (or title)
string.
On Fri, Sep 12, 2008 at 7:32 PM, phred78 <[EMAIL PROTECTED]> wrote:
>
> Oh, I see!
> You mean something like
>
> def
Oh, I see!
You mean something like
def __unicode__(self):
return self.title + ' | ' + self.language
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send
On Fri, Sep 12, 2008 at 12:40 PM, phred78 <[EMAIL PROTECTED]> wrote:
>
> Hello all,
>
> I've been googling for hours and I can't figure this out. I'm working
> on my first real project and came across a problem that some of you
> might have already solved.
>
> I have a table called Products and
Hello all,
I've been googling for hours and I can't figure this out. I'm working
on my first real project and came across a problem that some of you
might have already solved.
I have a table called Products and one called Language. The client
will insert several products per language. This is
7 matches
Mail list logo