add resize img

remotes/origin/mitri4
Dmitriy Shesterkin 9 years ago
parent 1be1ffdf24
commit 8be0f520c3
  1. 5
      batiskaf/settings.py
  2. 1
      requirements.txt
  3. 31
      store/migrations/0058_auto_20170506_0210.py
  4. 6
      store/models.py

@ -277,3 +277,8 @@ PRIVATE_KEY_PASS = "1q2w3e4r" # ; Пароль к закрытому ключу
PUBLIC_KEY_FN = os.path.join(BASE_DIR, 'kkb_keys',
'cert.pub') # "../paysys/kkbca.pem" # ; Путь к открытому ключу Public cert path
MERCHANT_ID = "92210431" # ; Терминал ИД в банковской Системе
DJANGORESIZED_DEFAULT_SIZE = [1920, 1080]
DJANGORESIZED_DEFAULT_QUALITY = 75
DJANGORESIZED_DEFAULT_KEEP_META = True

@ -33,3 +33,4 @@ virtualenvwrapper==4.6.0
wcwidth==0.1.4
wheel==0.24.0
xmljson==0.1.5
django-resized==0.3.5

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.3 on 2017-05-06 02:10
from __future__ import unicode_literals
from django.db import migrations, models
import django_resized.forms
import store.models
class Migration(migrations.Migration):
dependencies = [
('store', '0057_auto_20170306_1933'),
]
operations = [
migrations.AlterModelOptions(
name='currency',
options={'ordering': ['pk'], 'verbose_name': 'валюта', 'verbose_name_plural': 'валюты'},
),
migrations.AlterField(
model_name='category',
name='image',
field=django_resized.forms.ResizedImageField(blank=True, default=None, null=True, upload_to=store.models.photo_filename, verbose_name='Картинка'),
),
migrations.AlterField(
model_name='imageinproduct',
name='image',
field=django_resized.forms.ResizedImageField(upload_to=store.models.photo_filename, verbose_name='Картинка'),
),
]

@ -6,6 +6,7 @@ from accounts.models import Profile
from main.models import STARS_CHOICES
from store.alemtat import alemtat_get_cities_tuple, alemtat_get_services_tuple
from store.queryset import ProductQuerySet
from django_resized import ResizedImageField
FIELD_TYPE_CHAR = 'char'
FIELD_TYPE_INT = 'int'
@ -48,7 +49,7 @@ class Category(models.Model):
'self', default=None, null=True, blank=True, related_name='childs',
verbose_name='Родительская категория')
hide_products = models.BooleanField('Показывать дочерние категории вместо товаров', default=False)
image = models.ImageField('Картинка', upload_to=photo_filename, default=None, null=True, blank=True)
image = ResizedImageField('Картинка', upload_to=photo_filename, default=None, null=True, blank=True)
attributes = models.ManyToManyField(
'Attribute', through='AttributeForCategory')
priority = models.IntegerField('Приоритет', default=0)
@ -338,7 +339,8 @@ class SlugImageField(models.ImageField):
class ImageInProduct(models.Model):
image = models.ImageField('Картинка', upload_to=photo_filename)
image = ResizedImageField('Картинка', upload_to=photo_filename,
size=[1280, 1280], crop=['middle', 'center'])
product = models.ForeignKey(
Product, verbose_name='Товар', related_name='images')
is_main = models.BooleanField('Главная', default=False)

Loading…
Cancel
Save