this should work:

def get_authors(self):
    return self.authors.all()

list_display = ('title', 'Publisher', 'publicationDate',
'get_authors' )

Radovan


Fernando Rodríguez wrote:
> 
> 
> Hi,
> 
> I'm trying to display a many to many field in the admin interface.
> 
> This is my model:
> 
> class Book(models.Model):
>     title = models.CharField(maxlength = 100, db_index = True)
>     authors = models.ManyToManyField(Author)
>     Publisher = models.ForeignKey(Publisher)
>     publicationDate = models.DateField()
>     
>     class Admin: 
>         list_display = ('title', 'Publisher', 'publicationDate',
> 'authors' )
>         list_filter = ('Publisher', 'publicationDate') 
>         search_fields = ('title')
>     
>     def __str__(self):
>         return self.title
> 
> In the authors column, instead of the author's name(s), I get what seems
> to be the __str__ of an object:
> <django.db.models.fields.related.ManyRelatedManager object at 0x874352c>
> 
> How can I get this ManyRelatedManager to display what I want? O:-)
> 
> Thanks!
> 
> 
> 
> > 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/list_display-a-Many-to-Many-field-tp18361728p18361891.html
Sent from the django-users mailing list archive at Nabble.com.


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to