I have two models:

class Frontpage(models.Model):
        title = models.CharField(max_length=200)
        text = models.TextField()
        def __unicode__(self):
                return self.title
        class Meta:
                verbose_name_plural = "Frontpage"

class FrontpageImages(models.Model):
        title = models.CharField(max_length=200)
        alt = models.CharField(max_length=200)
        image = models.ImageField(upload_to='upload/%Y/%m/%d')
        page = models.ForeignKey(Frontpage)
        def __unicode__(self):
                return self.title

I will have one page with 4 blocks in it. In every block i want to
show the text from the frontpage model, and all his related images.
Like:

Block1:
Block2:                                etc.
    text                                 text
       - image1                          -image4
       - image2                          -image5
       - image3                          -image6

I cannot fetch all object from Frontpage and access frontpageimages
using _set

I could solve it by making 4 queries for id 1 till 4 but that would be
a bit overkill. What is the right way to use this data in my template?

Regards,

Rob

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