]> git.parisson.com Git - diggersdigest.git/commitdiff
update product style, add reference
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 28 Sep 2015 10:28:24 +0000 (12:28 +0200)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 28 Sep 2015 10:28:24 +0000 (12:28 +0200)
app/records/models.py
app/records/static/css/dig2.css
app/templates/shop/product.html

index 849432638d7377c43b6c4f628a3ceb8bb239fabf..574a4763aa4954170c5c9189072e40d2099447dd 100644 (file)
@@ -17,10 +17,7 @@ from mezzanine.core.models import CONTENT_STATUS_DRAFT, CONTENT_STATUS_PUBLISHED
 from mezzanine.blog.models import BlogPost
 from mezzanine.utils.models import upload_to
 
-from cartridge.shop.models import Product, Category, Cart, Order, ProductVariation, DiscountCode
-from paypal.standard.ipn.signals import payment_was_successful
-from paypal.standard.ipn.signals import valid_ipn_received
-
+from .utils import *
 
 # Auto-generated Django models with manage.py inspectdb on the old database
 # You'll have to do the following manually to clean this up:
@@ -296,62 +293,3 @@ class Podcast(BlogPost):
     #visu1 = models.IntegerField()
     # ordre : on laisse tombé ?
     # published --> status / 0 --> CONTENT_STATUS_DRAFT = 1 / 1 CONTENT_STATUS_PUBLISHED = 2
-
-
-def payment_complete(sender, **kwargs):
-    """Performs the same logic as the code in
-    cartridge.shop.models.Order.complete(), but fetches the session,
-    order, and cart objects from storage, rather than relying on the
-    request object being passed in (which it isn't, since this is
-    triggered on PayPal IPN callback)."""
-
-    ipn_obj = sender
-    print sender
-    if ipn_obj.custom and ipn_obj.invoice:
-        s_key, cart_pk = ipn_obj.custom.split(',')
-        SessionStore = import_module(settings.SESSION_ENGINE) \
-                           .SessionStore
-        session = SessionStore(s_key)
-
-        try:
-            cart = Cart.objects.get(id=cart_pk)
-            try:
-                order = Order.objects.get(
-                    transaction_id=ipn_obj.invoice)
-                print order
-                # order = Order.objects.get(key=s_key)
-                for field in order.session_fields:
-                    if field in session:
-                        del session[field]
-                try:
-                    del session["order"]
-                except KeyError:
-                    pass
-
-                # Since we're manually changing session data outside of
-                # a normal request, need to force the session object to
-                # save after modifying its data.
-                session.save()
-
-                for item in cart:
-                    try:
-                        variation = ProductVariation.objects.get(
-                            sku=item.sku)
-                    except ProductVariation.DoesNotExist:
-                        pass
-                    else:
-                        variation.update_stock(item.quantity * -1)
-                        variation.product.actions.purchased()
-
-                code = session.get('discount_code')
-                if code:
-                    DiscountCode.objects.active().filter(code=code) \
-                        .update(uses_remaining=F('uses_remaining') - 1)
-                cart.delete()
-            except Order.DoesNotExist:
-                pass
-        except Cart.DoesNotExist:
-            pass
-
-#payment_was_isuccessful.connect(payment_complete)
-valid_ipn_received.connect(payment_complete)
index 4fcdd3fb5f3a709908cc08d4716f0c84151a2ed4..398dbb770a7406c53e4d405ab94474149e9c859b 100644 (file)
@@ -34,6 +34,7 @@ hr {
     box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
     border: 1px solid #dddddd;
     border-radius: 4px;
+    list-style-type: none;
 }
 
 .navbar-default {
index c53f67414bc5178772aa6f61cd33cd5f22a64330..575b9d56903b4c2478b04d4e0d2f9d960ce7f153 100644 (file)
@@ -94,12 +94,22 @@ $(function () {
 
 <div class="col-md-6">
 <ul class="description">
-  <li><strong>{{ product.record.artist }}</strong></li>
-  <li><em>{{ product.record.title }}</em></li>
+    {% editable product.content %}
+    {{ product.content|richtext_filters|safe }}
+    {% endeditable %}
+
+  <li>{% trans "Artist" %}: <strong>{{ product.record.artist }}</strong></li>
+  <li>{% trans "Title" %}: <em>{{ product.record.title }}</em></li>
   <li>
     {% trans "Label:" %}
     {{ product.record.label }}
   </li>
+  {% if product.record.reference_label %}
+  <li>
+    {% trans "Reference" %}:
+    {{ product.record.reference_label }}
+  </li>
+  {% endif %}
   <li>
     {% trans "Country" %}:
     {{ product.record.country }}
@@ -111,7 +121,7 @@ $(function () {
   </li>
   {% else %}
   <li>
-    {% trans "Release decade:" %}
+    {% trans "Release decade" %}:
     {{ product.record.release_decade }}</li>
   {% endif %}
   <li>
@@ -148,15 +158,8 @@ $(function () {
 </div>
 </div>
 
-<div class="description">
-{% editable product.content %}
-{{ product.content|richtext_filters|safe }}
-{% endeditable %}
-</div>
-
 {% if product.available and has_available_variations and product.price %}
 
-<br/>
 {% errors_for add_product_form %}
 <form method="post" id="add-cart" class="shop-form">{% csrf_token %}
     <div style="display: none;">