So, I did this, and Django complains that a string was expected for
the join function, and it received an Artist instead.  I have a
__str__ method defined for my Artist class.  Shouldn't it
automatically be converting the Artist instance to a string?

On May 3, 10:15 am, Tim Chase <[EMAIL PROTECTED]> wrote:
> >>    def __str__(self):
> >>      return "%s (%s)" % (
> >>        self.title,
> >>        '/'.join(self.artists)
> >>        )
>
> >> This assumes that an Artist has a __str__ method as well.  If
> >> not, you could change that one line to
>
> >>    '/'.join([artist.name for artist in self.artists])
>
> > I did try that, with the artist having a __str__ method.  It
> > complained that it couldn't perform the join operation on a
> > ManyToManyManager.
>
> Oh... [smacks forehead]
>
> instead of "self.artists" try "self.artists.all()"
>
> (to return the results rather than the manager of those results)
>
> -tim


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

Reply via email to