diff --git a/longclaw/longclawbasket/migrations/0001_initial.py b/longclaw/longclawbasket/migrations/0001_initial.py index 0d47714..f7a6c18 100644 --- a/longclaw/longclawbasket/migrations/0001_initial.py +++ b/longclaw/longclawbasket/migrations/0001_initial.py @@ -3,6 +3,7 @@ from __future__ import unicode_literals from django.db import migrations, models +from django.conf import settings import django.db.models.deletion @@ -22,7 +23,7 @@ class Migration(migrations.Migration): ('basket_id', models.CharField(max_length=32)), ('date_added', models.DateTimeField(auto_now_add=True)), ('quantity', models.IntegerField(default=1)), - ('variant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='longclawproducts.ProductVariant')), + ('variant', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.PRODUCT_VARIANT_MODEL)), ], options={ 'ordering': ['date_added'], diff --git a/longclaw/longclaworders/migrations/0001_initial.py b/longclaw/longclaworders/migrations/0001_initial.py index a213ade..a2301cb 100644 --- a/longclaw/longclaworders/migrations/0001_initial.py +++ b/longclaw/longclaworders/migrations/0001_initial.py @@ -4,7 +4,7 @@ from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion - +from django.conf import settings class Migration(migrations.Migration): @@ -46,7 +46,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('quantity', models.IntegerField(default=1)), ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='longclaworders.Order')), - ('product', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to='longclawproducts.ProductVariant')), + ('product', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, to=settings.PRODUCT_VARIANT_MODEL)), ], ), ] diff --git a/longclaw/longclawproducts/migrations/0002_auto_20170219_0804.py b/longclaw/longclawproducts/migrations/0002_auto_20170219_0804.py new file mode 100644 index 0000000..f2c6238 --- /dev/null +++ b/longclaw/longclawproducts/migrations/0002_auto_20170219_0804.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.10.4 on 2017-02-19 08:04 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('longclawproducts', '0001_initial'), + ] + + operations = [ + migrations.RemoveField( + model_name='productvariant', + name='product', + ), + migrations.DeleteModel( + name='ProductVariant', + ), + ] diff --git a/longclaw/longclawproducts/models.py b/longclaw/longclawproducts/models.py index 9a75101..baea0eb 100644 --- a/longclaw/longclawproducts/models.py +++ b/longclaw/longclawproducts/models.py @@ -72,11 +72,6 @@ class ProductVariantBase(models.Model): def get_product_title(self): return self.product.title - -class ProductVariant(ProductVariantBase): - description = RichTextField() - stock = models.IntegerField(default=0) - class ProductImage(Orderable): product = ParentalKey(Product, related_name='images') diff --git a/longclaw/project_template/products/models.py b/longclaw/project_template/products/models.py index 24c29ca..6d4658e 100644 --- a/longclaw/project_template/products/models.py +++ b/longclaw/project_template/products/models.py @@ -1,3 +1,5 @@ +from django.db import models +from wagtail.wagtailcore.fields import RichTextField from longclaw.longclawproducts.models import ProductVariantBase class ProductVariant(ProductVariantBase): @@ -6,4 +8,5 @@ class ProductVariant(ProductVariantBase): # e.g. colour, size, stock and so on. # Remember, ProductVariantBase provides 'price', 'ref', 'slug' fields # and the parental key to the Product model. - pass + description = RichTextField() + stock = models.IntegerField(default=0) diff --git a/longclaw/project_template/project_name/templates/longclawproducts/product.html b/longclaw/project_template/project_name/templates/longclawproducts/product.html index 26b6f69..c85121a 100644 --- a/longclaw/project_template/project_name/templates/longclawproducts/product.html +++ b/longclaw/project_template/project_name/templates/longclawproducts/product.html @@ -1,38 +1,38 @@ -{% extends "base.html" %} +{{% templatetag openblock %} extends "base.html" {% templatetag closeblock %} -{% load wagtailcore_tags wagtailimages_tags %} +{% templatetag openblock %} load wagtailcore_tags wagtailimages_tags {% templatetag closeblock %} -{% block body_class %}template-productpage{% endblock %} +{% templatetag openblock %} block body_class {% templatetag closeblock %} template-productpage {% templatetag openblock %}endblock{% templatetag closeblock %} -{% block content %} +{% templatetag openblock %} block content {% templatetag closeblock %}
{{ item.caption }}
+ {% templatetag openblock %} image item.image fill-320x240 {% templatetag closeblock %} +{% templatetag openvariable %} item.caption {% templatetag closevariable %}