From db01805d60fc2ba657da255a77cd98b76f7d55e9 Mon Sep 17 00:00:00 2001 From: Thomas Fillon Date: Fri, 11 Sep 2015 11:17:48 +0200 Subject: [PATCH] Add showcase support and reduce margin for product grid --- .../records/templatetags/records_tags.py | 4 +- diggersdigest/static/css/dig2.css | 7 +++- diggersdigest/templates/index.html | 40 ++++++++++--------- diggersdigest/templates/pages/category.html | 2 +- diggersdigest/templates/shop/product.html | 2 +- 5 files changed, 33 insertions(+), 22 deletions(-) diff --git a/diggersdigest/records/templatetags/records_tags.py b/diggersdigest/records/templatetags/records_tags.py index 34480d5..6992f64 100644 --- a/diggersdigest/records/templatetags/records_tags.py +++ b/diggersdigest/records/templatetags/records_tags.py @@ -1,3 +1,5 @@ +from django.db.models import Q + from mezzanine import template from cartridge.shop.models import Product, Category @@ -15,7 +17,7 @@ def shop_recent_products(limit=5, category=None): {% blog_recent_posts limit=5 tag="django" as recent_posts %} {% blog_recent_posts limit=5 category="python" as recent_posts %} """ - products = Product.objects.published() + products = Product.objects.published().filter(available=True) title_or_slug = lambda s: Q(title=s) | Q(slug=s) if category is not None: diff --git a/diggersdigest/static/css/dig2.css b/diggersdigest/static/css/dig2.css index 55babe4..8a6968a 100644 --- a/diggersdigest/static/css/dig2.css +++ b/diggersdigest/static/css/dig2.css @@ -3,6 +3,11 @@ ) repeat; } +.slim_margins{ + padding-right:1px; + padding-left:1px; +} + body { padding-top: 300px; } @@ -14,4 +19,4 @@ hr { border-top: 2px solid #000; margin: 1em 0; padding: 0; -} \ No newline at end of file +} diff --git a/diggersdigest/templates/index.html b/diggersdigest/templates/index.html index bfad59d..8c363a5 100644 --- a/diggersdigest/templates/index.html +++ b/diggersdigest/templates/index.html @@ -9,25 +9,29 @@ {% endblock %} {% block main %} -{% blocktrans %} -

Congratulations!

-

- Welcome to your new Mezzanine powered website. - Here are some quick links to get you started: -

- -{% endblocktrans %} {% load blog_tags records_tags keyword_tags i18n mezzanine_tags %}
-

{% trans "Showcase" %}

+{% shop_recent_products limit=2 category="Showcase" as recent_products %} +{% if recent_products %} +

{% trans "Showcases" %}

+
+ {% for product in recent_products %} + +{% endfor %} +
+{% endif %} +
{% shop_recent_products 9 as recent_products %} @@ -35,7 +39,7 @@

{% trans "Latest Releases" %}