diff --git a/batiskaf/jinja2_ext/thumbnails.py b/batiskaf/jinja2_ext/thumbnails.py index 87f1f07..0576cbb 100644 --- a/batiskaf/jinja2_ext/thumbnails.py +++ b/batiskaf/jinja2_ext/thumbnails.py @@ -3,5 +3,5 @@ from easy_thumbnails.files import get_thumbnailer def thumbnail(img, size='420x420'): weight, height = size.split('x') - options = {'size': (int(weight), int(height)), 'crop': 'upscale'} + options = {'size': (int(weight), int(height))} return get_thumbnailer(img).get_thumbnail(options) diff --git a/batiskaf/settings.py b/batiskaf/settings.py index dd5029f..1f23a62 100644 --- a/batiskaf/settings.py +++ b/batiskaf/settings.py @@ -17,7 +17,6 @@ BASE_DIR = os.path.dirname(os.path.dirname(__file__)) ADMINS = ( ('spacenergy', 'spacenergy@me.com'), - ) MANAGERS = ADMINS diff --git a/static/js/_.js b/static/js/_.js index 598950a..57b13e3 100644 --- a/static/js/_.js +++ b/static/js/_.js @@ -66,89 +66,89 @@ $(document).ready(function () { }); - $('.product-min-thumbnails a').each(function(){ - var link = $(this); - link.on('click', function(){ - $('.product-big-thumbnail img').prop('src', link.prop('href')); - $('.product-big-thumbnail-container').trigger('zoom.destroy'); - $('.product-big-thumbnail-container').zoom({url: link.attr("data-big-url")}); +$('.product-min-thumbnails a').each(function(){ + var link = $(this); + link.on('click', function(){ + $('.product-big-thumbnail img').prop('src', link.prop('href')); + $('.product-big-thumbnail-container').trigger('zoom.destroy'); + $('.product-big-thumbnail-container').zoom({url: link.attr("data-big-url")}); //$('a#product-big-image-url').prop('href', link.attr('data-big-url')) return false; }) - }); - $('.product-big-thumbnail-container').zoom({url: $('#product-big-image-url').prop("href")}); - - - function create_cart_add_link(product_pk, count){ - return $.param.querystring('/store/cart/add/', 'pk=' + product_pk + '&count=' + count + '&next=' + window.location.pathname); - } - - function selectVariation(value, index){ - var price = $('.product-variations-selecter option[value=' + value + ']').attr('data-price'); - var in_stock = $('.product-variations-selecter option[value=' + value + ']').attr('data-count'); - $('.product-detail-price-span').html(price); - if (in_stock > 0){ - $(".product-count-selecter").selecter('destroy'); - $('.product-in-stock').show(); - $('.product-not-in-stock').hide(); - $('.product-count-selecter').html(''); - for (i=0; i'); - option.attr({ 'value': i+1 }).text((i+1) + ' шт.'); - $('.product-count-selecter').append(option); - } - $(".product-count-selecter").selecter({ - callback: selectCount - }); - selectCount(1, index); - $('#product-add-to-cart-link').prop('href', - create_cart_add_link($('.product-variations-selecter').val(), - $('.product-count-selecter').val())); - }else{ - $('.product-count-selecter').selecter('destroy'); - $('.product-in-stock').hide(); - $('.product-not-in-stock').show(); +}); +$('.product-big-thumbnail-container').zoom({url: $('#product-big-image-url').prop("href")}); + + +function create_cart_add_link(product_pk, count){ + return $.param.querystring('/store/cart/add/', 'pk=' + product_pk + '&count=' + count + '&next=' + window.location.pathname); +} + +function selectVariation(value, index){ + var price = $('.product-variations-selecter option[value=' + value + ']').attr('data-price'); + var in_stock = $('.product-variations-selecter option[value=' + value + ']').attr('data-count'); + $('.product-detail-price-span').html(price); + if (in_stock > 0){ + $(".product-count-selecter").selecter('destroy'); + $('.product-in-stock').show(); + $('.product-not-in-stock').hide(); + $('.product-count-selecter').html(''); + for (i=0; i'); + option.attr({ 'value': i+1 }).text((i+1) + ' шт.'); + $('.product-count-selecter').append(option); } - + $(".product-count-selecter").selecter({ + callback: selectCount + }); + selectCount(1, index); + $('#product-add-to-cart-link').prop('href', + create_cart_add_link($('.product-variations-selecter').val(), + $('.product-count-selecter').val())); + }else{ + $('.product-count-selecter').selecter('destroy'); + $('.product-in-stock').hide(); + $('.product-not-in-stock').show(); } - $(".product-variations-selecter").selecter({ - callback: selectVariation - }); +} - function selectCount(value, index){ - var price = parseInt($('.product-detail-price-span').html()); - $('.itogo-span').html(price*value); - $('#product-add-to-cart-link').prop('href', - create_cart_add_link($('.product-variations-selecter').val(), - $('.product-count-selecter').val())); - } +$(".product-variations-selecter").selecter({ + callback: selectVariation +}); - $(".product-count-selecter").selecter({ - callback: selectCount - }); +function selectCount(value, index){ + var price = parseInt($('.product-detail-price-span').html()); + $('.itogo-span').html(price*value); + $('#product-add-to-cart-link').prop('href', + create_cart_add_link($('.product-variations-selecter').val(), + $('.product-count-selecter').val())); +} +$(".product-count-selecter").selecter({ + callback: selectCount +}); - if ($('.product-count-selecter option').size() < 1){ - $('.product-in-stock').hide(); - $('.product-not-in-stock').show(); - }else{ - $(".product-count-selecter").selecter(); - } +if ($('.product-count-selecter option').size() < 1){ + $('.product-in-stock').hide(); + $('.product-not-in-stock').show(); - $('ul.messages li').each(function(){ - var li = $(this); - var messageType = li.attr('data-type'); - swal({ - html: true, - type: messageType, - title: "OK!", - text: li.html() +}else{ + $(".product-count-selecter").selecter(); +} + +$('ul.messages li').each(function(){ + var li = $(this); + var messageType = li.attr('data-type'); + swal({ + html: true, + type: messageType, + title: "OK!", + text: li.html() - }); }); +}); diff --git a/store/admin.py b/store/admin.py index b47e207..29616aa 100644 --- a/store/admin.py +++ b/store/admin.py @@ -24,7 +24,13 @@ class BrandAdmin(admin.ModelAdmin): @admin.register(Category) class CategoryAdmin(admin.ModelAdmin): - list_display = ('title',) + + def get_str(object): + return object.__str__() + + get_str.short_description = 'Полный путь' + + list_display = ('title', get_str,) prepopulated_fields = {"slug": ("title",)} inlines = [AttributeForCategoryInline, ]