Can you list your models.py for me? What exactly do you want to show
in your template? I'm guessing some sort of WHERE clause, like all
filmmakers for a film or something.

On Aug 16, 5:08 pm, Wendy <we...@mutantfactory.com> wrote:
> OK, I have the inline solution working in the admin, I can see why
> it's prettier!
> Now I'm trying to figure out how to refer to these filmmakers in my
> film list template, as there is no longer a film.filmmakers object...
> So when I look in mysql, films_filmmakerposition has an id, a
> filmmaker id, a film id and a position.
> My Filmmaker Object has a first name and last name.
> I'm not sure where to start on this one, any help would be greatly
> appreciated.
> Thanks,
> Wendy
>
> On Aug 16, 12:45 pm, Wendy <we...@mutantfactory.com> wrote:
>
>
>
> > Thanks, Nick, I just figured that out, doh!  So I got the first
> > example going, I guess I'll try the inline solution as well, if it's
> > the pretty way to do it...  It'll be good for me to actually see what
> > they both do.
> > W
>
> > On Aug 16, 12:28 pm, Nick Serra <nickse...@gmail.com> wrote:
>
> > > The inline solution is the pretty way to do it. If you just want the
> > > join to show up in the admin, then simply register the join model in
> > > the admin like any other model. In your admin,py include
> > > FilmmakerPosition and then do admin.site.register(FilmmakerPosition)
>
> > > On Aug 16, 3:24 pm, Wendy <we...@mutantfactory.com> wrote:
>
> > > > Thanks Nick,
> > > > I tried the first solution first.
> > > > You're right, the many to manys aren't editable on that page, but the
> > > > problem is, I'm not seeing another admin page for the new join model:
>
> > > > class FilmmakerPosition(models.Model):
> > > >          filmmaker = models.ForeignKey(Filmmaker)
> > > >          film = models.ForeignKey(Film)
> > > >          position = models.IntegerField()
> > > > ----------------------------------------------------
> > > > (it is in the db)
> > > > so there's no way I can assign filmmakers to a film in the admin.
> > > > In the Film class it specifies:
> > > > --------------------
> > > > filmmakers = models.ManyToManyField(Filmmaker,
> > > > through='FilmmakerPosition')
> > > > --------------------
>
> > > > Am I missing something?
>
> > > > I was slightly more intimidated by the inline example, as I'm not sure
> > > > I want to scrap the many to many relationship.  (there are lots of
> > > > films that have multiple filmmakers and vice versa, and I'd like to be
> > > > able to list them on both ends)  I'm still trying to wrap my head
> > > > around how I could do that with this example.
>
> > > > If anyone has anything else to add that would help me understand it
> > > > better, I'd really appreciate it.
>
> > > > Thanks,
> > > > Wendy
>
> > > > On Aug 13, 10:03 am, Nick Serra <nickse...@gmail.com> wrote:
>
> > > > > You can go two directions with this. First, you could use a
> > > > > intermediate model for the many to many join, which would allow you to
> > > > > specify extra field on the join, in this case the order. Read up on
> > > > > this 
> > > > > here:http://docs.djangoproject.com/en/dev/topics/db/models/#extra-fields-o...
>
> > > > > The problem with solution one is that the many to many won't be
> > > > > editable on that page anymore.
>
> > > > > Solution two would be to scrap the manytomany and use inline models
> > > > > instead. You would make an intermediate model, say FilmmakerItem,
> > > > > which would foreign key to the model you want to join to, and a
> > > > > foreign key to the filmmaker, and would have a field for order. This
> > > > > would be editable in the admin under the same page.
>
> > > > > Read about inline 
> > > > > here:http://docs.djangoproject.com/en/dev/ref/contrib/admin/#inlinemodelad...
>
> > > > > On Aug 13, 12:52 pm, Wendy <we...@mutantfactory.com> wrote:
>
> > > > > > I have a many to many field, with the horizontal available and 
> > > > > > chosen
> > > > > > boxes in the admin.  I wanted to see if there's any way that an 
> > > > > > admin
> > > > > > can select the order that the chosen objects show up, and have it be
> > > > > > saved and display that way.  Right now, they're not ordered, but 
> > > > > > seem
> > > > > > to show up based on when the object was created.  So I'm choosing
> > > > > > filmmakers for a film, and the only way I can change the order is to
> > > > > > destroy the filmmaker objects, then recreate and add them in a
> > > > > > different order, something that obviously wouldn't work in the real
> > > > > > world.  Is there any way to save the order in the chosen box in the
> > > > > > admin?
>
> > > > > > Thanks,
> > > > > > Wendy

-- 
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