djangosnippets.org: Latest snippets tagged with 'variations'https://djangosnippets.org/tags/variations/2008-08-14T07:34:41.801561-05:00Imagefield with variations
2008-08-14T07:34:41.801561-05:00fivethreeohttps://djangosnippets.org/snippets/978/<p>Usage:</p>
<pre><code>from django.db import models
from imagevariations.fields import ImageVariationsField, Thumbnail
class Image(models.Model):
name = models.CharField(max_length=20)
image = ImageVariationsField(upload_to='testimages', variations=(Thumbnail,) )
</code></pre>
<p>How to use in templates:</p>
<p>Use the lowercase name of the image variation class.</p>
<pre><code>{{ object.image.variations.thumbnail.url }}
</code></pre>
<p>By default all image variations will use the same storage backend as the …</p>
Freely redistributable