The problem:
imsettop and imsetbottrom return an image_set.all
headset doesnt, yet the code to get all three are almost identical

can anyone spot the error please?

I have 2 models going through a view to a template

simple models:
model image_sets

from django.db import models
from smartpages.models import SmartPage

POSITIONCHOICES = [
    ('1', 'Top'),
    ('2', 'Bottom')
    ]

class Set(models.Model):
    assigned_page = models.ForeignKey(SmartPage, help_text='The smartpage
this set is assigned to')
    position = models.CharField(choices=POSITIONCHOICES, max_length=1)
    name = models.CharField(max_length=50, help_text='An identifying name,
like the name of the smartpage')

    def __unicode__(self):
        return self.name

class Image(models.Model):
    page = models.ForeignKey(Set)
    image = models.ImageField(upload_to='page_sets')

model head_sets

from django.db import models
from smartpages.models import SmartPage

class HeadSet(models.Model):
    assigned_page = models.ForeignKey(SmartPage, help_text='The smartpage
this set is assigned to')
    name = models.CharField(max_length=50, help_text='An identifying name,
like the name of the smartpage')

    def __unicode__(self):
        return self.name

class HeadImage(models.Model):
    page = models.ForeignKey(HeadSet)
    image = models.ImageField(upload_to='head_sets')


View  // sp = the page being delivered

from image_sets.models import Set, Image
from head_sets.models import HeadSet, HeadImage

    imsettop =
Set.objects.all().filter(position=1).filter(assigned_page=sp.id)
    imsetbottom = Set.objects.all().filter(position=2).filter(assigned_page
= sp.id)
    headset = HeadSet.objects.all().filter(assigned_page = sp.id)

Template
                            <div id="headimage">
                                {% for x in headset %}
                                    {% for t in x.image_set.all %}
                                         {{ t.image.url }} 
                                    {% endfor %}
                                {% endfor %}
                            </div>


                                            <div id="imgsettop"
style="float:left; margin-top:25px;">
                                                {% for i in imsettop %}
                                                    {% for x in
i.image_set.all %}
                                                        
{{x.image.url|thumbnail: 
                                                    {% endfor %}
                                                {% endfor %}
                                            </div>

                                            <div id="imgsetbottom"
style="clear:left; float:left; margin-top:40px;">
                                                {% for y in imsetbottom %}
                                                    {% for w in
y.image_set.all %}
                                                        
{{w.image.url|thumbnail: 
                                                    {% endfor %}
                                                {% endfor %}
                                            </div>







-- 
View this message in context: 
http://old.nabble.com/no-return-from-image_set.all-yet-code-almost-identical-tp32723239p32723239.html
Sent from the django-users mailing list archive at Nabble.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to