Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Add previews to images in admin

Patryk Zawadzkic920e1391957
diff --git a/product/models.py b/product/models.py
index 6ae2fdd3f6..05843635c0 100644
--- a/product/models.py
+++ b/product/models.py
@@ -163,6 +163,11 @@ class ProductImage(Image):
class Meta:
ordering = ['id']
+ def __unicode__(self):
+ html = u'<img src="%s" alt="">' % (
+ self.get_absolute_url('admin'),)
+ return mark_safe(html)
+
class ProductDiscountManager(models.Manager):
diff --git a/saleor/settings.py b/saleor/settings.py
index 259be57429..03e80a6562 100644
--- a/saleor/settings.py
+++ b/saleor/settings.py
@@ -169,6 +169,10 @@ CANONICAL_HOSTNAME = 'localhost:8000'
IMAGE_SIZES = {
'normal': {
'size': (750, 0)
+ },
+ 'admin': {
+ 'size': (50, 50),
+ 'crop': True
}
}
diff --git a/setup.py b/setup.py
index 70438eef65..4f1a23f305 100755
--- a/setup.py
+++ b/setup.py
@@ -23,7 +23,7 @@ setup(
include_package_data=True,
install_requires=[
'Django>=1.5',
- 'django-images>=0.3,<-0.4a0',
+ 'django-images>=0.3.1,<-0.4a0',
'django-mptt>=0.5',
'django-payments>=0.3,<0.4a0',
'django-prices>=0.2,<0.3a0',