From b72228dbb361d3a2cf00688d1ec497f0fdd94114 Mon Sep 17 00:00:00 2001 From: Sanj Date: Wed, 5 Oct 2011 19:54:04 +0530 Subject: [PATCH] thumbnails --- itf/bestpractices/models.py | 8 ++++++-- .../modules/bestpractices/bestpractice.html | 13 +++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/itf/bestpractices/models.py b/itf/bestpractices/models.py index f1b348d..3768b2a 100644 --- a/itf/bestpractices/models.py +++ b/itf/bestpractices/models.py @@ -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): diff --git a/itf/templates/modules/bestpractices/bestpractice.html b/itf/templates/modules/bestpractices/bestpractice.html index 2cde61d..ac7c909 100644 --- a/itf/templates/modules/bestpractices/bestpractice.html +++ b/itf/templates/modules/bestpractices/bestpractice.html @@ -1,16 +1,21 @@ +{% load thumbnail %}
{% for s in stories %} Story: {{ s.text }} - + {% thumbnail s.image "100x100" crop="center" as im %} + + {% endthumbnail %}

{% endfor %} Law: {{ law }} {% if law_image %} - + {% thumbnail law_image "100x100" crop="center" as im %} + + {% endthumbnail %} {% endif %}

- Relevance to Theatre: {{ theatre|linebreaks }} - Quick Howto: {{ quick_howto }}

+ Relevance to Theatre: {{ theatre|linebreaksbr }} + Quick Howto: {{ quick_howto|linebreaksbr }}