I know this is dumb but...
I have two model classes
class Gallery(models.Model):
name = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published', auto_now_add=True)
def __unicode__(self):
return self.name
class Image(models.Model):
gallery = models.ForeignKey(Gallery)
image = models.ImageField(upload_to='gallery/%Y/%m/%d')
caption = models.TextField(blank=True)
up_date = models.DateTimeField(auto_now_add=True)
def __unicode__(self):
return self.caption
I want three types of query
- Get all the "Gallery" with one "Image" from that gallery
- Get all the image from a single gallery
third one I can handle get a specific image from a "Image"