Leon,
Use ajax and json. Create a view method that returns a json list of actors and their ids, then populate your list with this. > > > -----Original Message----- > > From: django-users@googlegroups.com > > [mailto:django-us...@googlegroups.com] On Behalf Of Léon Dignòn > > Sent: Wednesday, September 16, 2009 8:05 AM > > To: Django users > > Subject: Re: Select models based on m2m relationship. > > > > > > bump > > > > On 15 Sep., 19:36, Léon Dignòn <leon.dig...@gmail.com> wrote: > > > Hello, > > > > > > I have a m2m relationship like this: > > > > > > class Actor(models.Model): > > > name = models.CharField(unique=True) class Movie(models.Model): > > > name = models.CharField(unique=True) > > > actors = models.ManyToManyField(Actor) class > > > Comment(models.Model): > > > actor = models.ForeignKey(Actor) > > > movie = models.ForeignKey(Movie) > > > comment = models.CharField() > > > > > > Every actor belongs to a number movies, every movie > > contains a number > > > of actors. > > > > > > What I want to achieve is, that in the form I chose a movie > > from the > > > movie-dropdown list, then the actor-dropdown displays only actors > > > acting in that particular movie. This can happen with javascript, > > > ajax, or any other good stuff. > > > > > > I don't know wheter to use javascript, or ajax, or > > whatever. I don't > > > know if my model is good. Please help me starting with this. It's a > > > little complex at the moment :) > > > > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---