thumbnails

This commit is contained in:
Sanj 2011-10-05 19:54:04 +05:30
parent 38ea6a6fee
commit b72228dbb3
2 changed files with 15 additions and 6 deletions

View File

@ -42,7 +42,8 @@ class BestPractice(ItfModel):
'theatre': self.theatre,
'quick_howto': self.quick_howto,
'category': self.category.name,
'category_id': self.category.id
'category_id': self.category.id,
'images': self.get_images()
}
def list_dict(self):
@ -64,11 +65,14 @@ class BestPractice(ItfModel):
def get_images(self):
images = []
for i in BestPracticeImage.objects.filter(bestpractice=self):
images.append(i)
'''
images.append({
'url': i.image.url,
'caption': i.caption,
'thumb': i.get_thumb()
})
'''
return images
'''
@ -93,7 +97,7 @@ class BestPracticeStory(models.Model):
def get_dict(self):
return {
'text': self.text,
'image': self.image.url if self.image.name != '' else ''
'image': self.image if self.image.name != '' else None
}
class BestPracticeFAQ(ItfModel):

View File

@ -1,16 +1,21 @@
{% load thumbnail %}
<div class="itfInfo">
{% for s in stories %}
<span class="itfInfoSub">Story: </span><span class="ifInfoInfo">{{ s.text }}</span>
<img class="itfInfoImg" src="{{ s.image }}" />
{% thumbnail s.image "100x100" crop="center" as im %}
<img class="itfInfoImg" src="{{ im.url }}" />
{% endthumbnail %}
<br /><br />
{% endfor %}
<span class="itfInfoSub">Law: </span><span class="itfInfoInfo">{{ law }}</span>
{% if law_image %}
<img class="itfInfoImg" src="{{ law_image }}" />
{% thumbnail law_image "100x100" crop="center" as im %}
<img class="itfInfoImg" src="{{ im.url }}" />
{% endthumbnail %}
{% endif %}
<br /><br />
<span class="itfInfoSub">Relevance to Theatre: </span><span class="itfInfoInfo">{{ theatre|linebreaks }}</span>
<span class="itfInfoSub">Quick Howto: </span><span class="itfInfoInfo">{{ quick_howto }}</span><br /><br />
<span class="itfInfoSub">Relevance to Theatre: </span><span class="itfInfoInfo">{{ theatre|linebreaksbr }}</span>
<span class="itfInfoSub">Quick Howto: </span><span class="itfInfoInfo">{{ quick_howto|linebreaksbr }}</span><br /><br />
</div>