image in preview
This commit is contained in:
parent
4e5fdbe8a7
commit
b42709604f
|
@ -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)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<span class="itfPreviewTitle">${title}</span><br /><br />
|
||||
<span class="itfPreviewSub">Category: </span><span class="itfPreviewText">${category}</span> <br /><br />
|
||||
<div class="itfPreviewImages">
|
||||
{{each images}} <img src="${$value.url}" title="${$value.caption}" /> {{/each}}
|
||||
{{each images}} <img src="${$value.thumb}" width="200" title="${$value.caption}" /> {{/each}}
|
||||
</div>
|
||||
<span class="itfPreviewSub">Story: </span><span class="itfPreviewText">${story}</span>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user