I have a Movie model
and I have a Image model
the Image model has a ForeignKey(Movie)

Each Movie has an arbitrary amount of Images.

I have a view where I list all the Movies.
For each Movie entry, I want one Image.

How do I do that?

I can do a "movies = Movies.objects.all()" and pass "movies" to the 
template, but I don't know how to attach an image
How do I get one, and only one, Image for each Movie?

The only thing I can think about is using a for-loop on the returned 
list of movies, but that will hit the database an awfully lot.

--
-0.5


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

Reply via email to