From b42709604f36fbcc2b6625500f34d873bdf78679 Mon Sep 17 00:00:00 2001 From: sanj Date: Wed, 19 Jan 2011 14:11:55 +0530 Subject: [PATCH] image in preview --- itf/bestpractices/models.py | 8 ++++++-- itf/templates/bestpractices/BestPractice/preview.html | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/itf/bestpractices/models.py b/itf/bestpractices/models.py index 5e2e039..4ab3a8b 100644 --- a/itf/bestpractices/models.py +++ b/itf/bestpractices/models.py @@ -57,7 +57,8 @@ class BestPractice(ItfModel): for i in BestPracticeImage.objects.filter(bestpractice=self): images.append({ 'url': i.image.url, - 'caption': i.caption + 'caption': i.caption, + 'thumb': i.get_thumb() }) return images @@ -82,7 +83,10 @@ class BestPracticeImage(models.Model): bestpractice = models.ForeignKey(BestPractice) def __unicode__(self): - return self.caption + return self.caption + + def get_thumb(self, max_width='200'): + return self.image.url #FIXME!! class Guideline(models.Model): title = models.CharField(max_length=512) diff --git a/itf/templates/bestpractices/BestPractice/preview.html b/itf/templates/bestpractices/BestPractice/preview.html index c037c51..dbd5a47 100644 --- a/itf/templates/bestpractices/BestPractice/preview.html +++ b/itf/templates/bestpractices/BestPractice/preview.html @@ -2,7 +2,7 @@ ${title}

Category: ${category}

- {{each images}} {{/each}} + {{each images}} {{/each}}
Story: ${story}