I need some help (sorry for my poor english).
I 'm trying to get all photos from each album. I don't know how to make the query. I need this data (and order the photos by atribute "order" it will fantastic).
House1-title
photo1: descritpion
photo2: descritpion
photo3: descritpion
House2-title
photo1: descritpion
photo2: descritpion
photo3: descritpion
The model (abbreviated) looks like this, which is more easy to make the query? and wich is more efficient? (i know, the best solution is using memcache).
Option A:
class House(ImageModel):
title = models.CharField(max_length=25)
photos = models.ManyToManyField('Photo')
class Photo(ImageModel):
photo = models.ImageField(upload_to='photos/originals')
description = models.CharField(max_length=100)
order = models.IntegerField()
Option B:
class House(ImageModel):
title = models.CharField(max_length=25)
class Photo(ImageModel):
house = models.ForeignKey(House)
photo = models.ImageField(upload_to='photos/originals')
description = models.CharField(max_length=100)
order = models.IntegerField()
Thanks !