Wilmer A. Delpratt (wdelprat...@gmail.com) wrote:
> Hi everyone..i'm new in this group...my friends says this is one of
> the best groups...
> I'd like to know how i can use a ManyToManyField in a "list_display",
> i've read the documentation, but there says this is not possible
> (isn't supported),....i wish to know if there is another way to solve
> this problem (i really need to do that)....well that's all...thanks a
> lot....
> PD: Sorry my bad english........i'm from Cuba (official language
> 'Spanish').
> Once again thank you all.......please help me.....see you
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to django-us...@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.
> 

Hey Wilmer :)

First of all I must criticize your attempt to ask a simple question.
Ever heard of using a meaningful subject [1]_, or how to ask *smart
questions* [2]_? Your style honestly sucks and is painful to read.=20
Period.

Back to topic:
Using a ManyToManyField in the Django's model class is not possible
AFAIK, but by writing a little Python function you can easily handly
this.

Take the following example:

class Book(models.Model):
        ...
        authors =3D models.ManyToManyField(Author)
        ...

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

        class Admin:
                list_display =3D ('get_authors')

This is pretty self-explanatory and not tested, but should work.

> Hi everyone..i'm new in this group...my friends says this is one of
> the best groups...
They're certainly right your friends. ;)

Hope I could help,
Kenny

.. [1] http://www.hoax-slayer.com/email-subject-lines.html
.. [2] http://catb.org/~esr/faqs/smart-questions.html
-- 
  Kenny Meyer
  Software Geek | http://kenny.alwaysdata.net

  Shoot for the moon, even if you miss, you'll land amongst the stars..
    - Les Brown

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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