From: Guillaume Pellerin Date: Wed, 7 Sep 2016 15:28:40 +0000 (+0200) Subject: NEED REBUILD, add cartridge and then (empty) organization.products modules X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=9fc892d0beefea1ba08d4fb37c2951820be693a5;p=mezzo.git NEED REBUILD, add cartridge and then (empty) organization.products modules --- diff --git a/app/migrations/shop/0001_initial.py b/app/migrations/shop/0001_initial.py new file mode 100644 index 00000000..f1d4cf13 --- /dev/null +++ b/app/migrations/shop/0001_initial.py @@ -0,0 +1,302 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +from decimal import Decimal +import mezzanine.utils.models +import mezzanine.core.fields +import cartridge.shop.fields + +from mezzanine.conf import settings + +class Migration(migrations.Migration): + + dependencies = [ + ('pages', '0001_initial'), + ('sites', '0001_initial'), + ] + + operations = [ + migrations.CreateModel( + name='Cart', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('last_updated', models.DateTimeField(null=True, verbose_name='Last updated')), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='CartItem', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('sku', cartridge.shop.fields.SKUField(max_length=20, verbose_name='SKU')), + ('description', models.CharField(max_length=2000, verbose_name='Description')), + ('quantity', models.IntegerField(default=0, verbose_name='Quantity')), + ('unit_price', cartridge.shop.fields.MoneyField(decimal_places=2, default=Decimal('0'), max_digits=10, blank=True, null=True, verbose_name='Unit price')), + ('total_price', cartridge.shop.fields.MoneyField(decimal_places=2, default=Decimal('0'), max_digits=10, blank=True, null=True, verbose_name='Total price')), + ('url', models.CharField(max_length=2000)), + ('image', models.CharField(max_length=200, null=True)), + ('cart', models.ForeignKey(related_name='items', to='shop.Cart')), + ], + options={ + 'abstract': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Category', + fields=[ + ('page_ptr', models.OneToOneField(parent_link=True, auto_created=True, primary_key=True, serialize=False, to='pages.Page')), + ('content', mezzanine.core.fields.RichTextField(verbose_name='Content')), + ('featured_image', mezzanine.core.fields.FileField(max_length=255, null=True, verbose_name='Featured Image', blank=True)), + ('price_min', cartridge.shop.fields.MoneyField(null=True, verbose_name='Minimum price', max_digits=10, decimal_places=2, blank=True)), + ('price_max', cartridge.shop.fields.MoneyField(null=True, verbose_name='Maximum price', max_digits=10, decimal_places=2, blank=True)), + ('combined', models.BooleanField(default=True, help_text='If checked, products must match all specified filters, otherwise products can match any specified filter.', verbose_name='Combined')), + ], + options={ + 'ordering': ('_order',), + 'verbose_name': 'Product category', + 'verbose_name_plural': 'Product categories', + }, + bases=('pages.page', models.Model), + ), + migrations.CreateModel( + name='DiscountCode', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('title', models.CharField(max_length=100, verbose_name='Title')), + ('active', models.BooleanField(default=False, verbose_name='Active')), + ('discount_deduct', cartridge.shop.fields.MoneyField(null=True, verbose_name='Reduce by amount', max_digits=10, decimal_places=2, blank=True)), + ('discount_percent', cartridge.shop.fields.PercentageField(null=True, verbose_name='Reduce by percent', max_digits=5, decimal_places=2, blank=True)), + ('discount_exact', cartridge.shop.fields.MoneyField(null=True, verbose_name='Reduce to amount', max_digits=10, decimal_places=2, blank=True)), + ('valid_from', models.DateTimeField(null=True, verbose_name='Valid from', blank=True)), + ('valid_to', models.DateTimeField(null=True, verbose_name='Valid to', blank=True)), + ('code', cartridge.shop.fields.DiscountCodeField(unique=True, max_length=20, verbose_name='Code')), + ('min_purchase', cartridge.shop.fields.MoneyField(null=True, verbose_name='Minimum total purchase', max_digits=10, decimal_places=2, blank=True)), + ('free_shipping', models.BooleanField(default=False, verbose_name='Free shipping')), + ('uses_remaining', models.IntegerField(help_text='If you wish to limit the number of times a code may be used, set this value. It will be decremented upon each use.', null=True, verbose_name='Uses remaining', blank=True)), + ('categories', models.ManyToManyField(related_name='discountcode_related', verbose_name='Categories', to='shop.Category', blank=True)), + ], + options={ + 'verbose_name': 'Discount code', + 'verbose_name_plural': 'Discount codes', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Order', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('billing_detail_first_name', models.CharField(max_length=100, verbose_name='First name')), + ('billing_detail_last_name', models.CharField(max_length=100, verbose_name='Last name')), + ('billing_detail_street', models.CharField(max_length=100, verbose_name='Street')), + ('billing_detail_city', models.CharField(max_length=100, verbose_name='City/Suburb')), + ('billing_detail_state', models.CharField(max_length=100, verbose_name='State/Region')), + ('billing_detail_postcode', models.CharField(max_length=10, verbose_name='Zip/Postcode')), + ('billing_detail_country', models.CharField(max_length=100, verbose_name='Country')), + ('billing_detail_phone', models.CharField(max_length=20, verbose_name='Phone')), + ('billing_detail_email', models.EmailField(max_length=75, verbose_name='Email')), + ('shipping_detail_first_name', models.CharField(max_length=100, verbose_name='First name')), + ('shipping_detail_last_name', models.CharField(max_length=100, verbose_name='Last name')), + ('shipping_detail_street', models.CharField(max_length=100, verbose_name='Street')), + ('shipping_detail_city', models.CharField(max_length=100, verbose_name='City/Suburb')), + ('shipping_detail_state', models.CharField(max_length=100, verbose_name='State/Region')), + ('shipping_detail_postcode', models.CharField(max_length=10, verbose_name='Zip/Postcode')), + ('shipping_detail_country', models.CharField(max_length=100, verbose_name='Country')), + ('shipping_detail_phone', models.CharField(max_length=20, verbose_name='Phone')), + ('additional_instructions', models.TextField(verbose_name='Additional instructions', blank=True)), + ('time', models.DateTimeField(auto_now_add=True, verbose_name='Time', null=True)), + ('key', models.CharField(max_length=40)), + ('user_id', models.IntegerField(null=True, blank=True)), + ('shipping_type', models.CharField(max_length=50, verbose_name='Shipping type', blank=True)), + ('shipping_total', cartridge.shop.fields.MoneyField(null=True, verbose_name='Shipping total', max_digits=10, decimal_places=2, blank=True)), + ('tax_type', models.CharField(max_length=50, verbose_name='Tax type', blank=True)), + ('tax_total', cartridge.shop.fields.MoneyField(null=True, verbose_name='Tax total', max_digits=10, decimal_places=2, blank=True)), + ('item_total', cartridge.shop.fields.MoneyField(null=True, verbose_name='Item total', max_digits=10, decimal_places=2, blank=True)), + ('discount_code', cartridge.shop.fields.DiscountCodeField(max_length=20, verbose_name='Discount code', blank=True)), + ('discount_total', cartridge.shop.fields.MoneyField(null=True, verbose_name='Discount total', max_digits=10, decimal_places=2, blank=True)), + ('total', cartridge.shop.fields.MoneyField(null=True, verbose_name='Order total', max_digits=10, decimal_places=2, blank=True)), + ('transaction_id', models.CharField(max_length=255, null=True, verbose_name='Transaction ID', blank=True)), + ('status', models.IntegerField(default=settings.SHOP_ORDER_STATUS_CHOICES[0][0], verbose_name='Status', choices=settings.SHOP_ORDER_STATUS_CHOICES)), + ('site', models.ForeignKey(editable=False, to='sites.Site')), + ], + options={ + 'ordering': ('-id',), + 'verbose_name': 'Order', + 'verbose_name_plural': 'Orders', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='OrderItem', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('sku', cartridge.shop.fields.SKUField(max_length=20, verbose_name='SKU')), + ('description', models.CharField(max_length=2000, verbose_name='Description')), + ('quantity', models.IntegerField(default=0, verbose_name='Quantity')), + ('unit_price', cartridge.shop.fields.MoneyField(decimal_places=2, default=Decimal('0'), max_digits=10, blank=True, null=True, verbose_name='Unit price')), + ('total_price', cartridge.shop.fields.MoneyField(decimal_places=2, default=Decimal('0'), max_digits=10, blank=True, null=True, verbose_name='Total price')), + ('order', models.ForeignKey(related_name='items', to='shop.Order')), + ], + options={ + 'abstract': False, + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Product', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('keywords_string', models.CharField(max_length=500, editable=False, blank=True)), + ('rating_count', models.IntegerField(default=0, editable=False)), + ('rating_sum', models.IntegerField(default=0, editable=False)), + ('rating_average', models.FloatField(default=0, editable=False)), + ('title', models.CharField(max_length=500, verbose_name='Title')), + ('slug', models.CharField(help_text='Leave blank to have the URL auto-generated from the title.', max_length=2000, null=True, verbose_name='URL', blank=True)), + ('_meta_title', models.CharField(help_text='Optional title to be used in the HTML title tag. If left blank, the main title field will be used.', max_length=500, null=True, verbose_name='Title', blank=True)), + ('description', models.TextField(verbose_name='Description', blank=True)), + ('gen_description', models.BooleanField(default=True, help_text='If checked, the description will be automatically generated from content. Uncheck if you want to manually set a custom description.', verbose_name='Generate description')), + ('created', models.DateTimeField(null=True, editable=False)), + ('updated', models.DateTimeField(null=True, editable=False)), + ('status', models.IntegerField(default=2, help_text='With Draft chosen, will only be shown for admin users on the site.', verbose_name='Status', choices=[(1, 'Draft'), (2, 'Published')])), + ('publish_date', models.DateTimeField(help_text="With Published chosen, won't be shown until this time", null=True, verbose_name='Published from', blank=True)), + ('expiry_date', models.DateTimeField(help_text="With Published chosen, won't be shown after this time", null=True, verbose_name='Expires on', blank=True)), + ('short_url', models.URLField(null=True, blank=True)), + ('in_sitemap', models.BooleanField(default=True, verbose_name='Show in sitemap')), + ('content', mezzanine.core.fields.RichTextField(verbose_name='Content')), + ('unit_price', cartridge.shop.fields.MoneyField(null=True, verbose_name='Unit price', max_digits=10, decimal_places=2, blank=True)), + ('sale_id', models.IntegerField(null=True)), + ('sale_price', cartridge.shop.fields.MoneyField(null=True, verbose_name='Sale price', max_digits=10, decimal_places=2, blank=True)), + ('sale_from', models.DateTimeField(null=True, verbose_name='Sale start', blank=True)), + ('sale_to', models.DateTimeField(null=True, verbose_name='Sale end', blank=True)), + ('sku', cartridge.shop.fields.SKUField(max_length=20, unique=True, null=True, verbose_name='SKU', blank=True)), + ('num_in_stock', models.IntegerField(null=True, verbose_name='Number in stock', blank=True)), + ('available', models.BooleanField(default=False, verbose_name='Available for purchase')), + ('image', models.CharField(max_length=100, null=True, verbose_name='Image', blank=True)), + ('date_added', models.DateTimeField(auto_now_add=True, verbose_name='Date added', null=True)), + ('categories', models.ManyToManyField(to='shop.Category', verbose_name='Product categories', blank=True)), + ('related_products', models.ManyToManyField(related_name='related_products_rel_+', verbose_name='Related products', to='shop.Product', blank=True)), + ('site', models.ForeignKey(editable=False, to='sites.Site')), + ('upsell_products', models.ManyToManyField(related_name='upsell_products_rel_+', verbose_name='Upsell products', to='shop.Product', blank=True)), + ], + options={ + 'verbose_name': 'Product', + 'verbose_name_plural': 'Products', + }, + bases=(models.Model, mezzanine.utils.models.AdminThumbMixin), + ), + migrations.CreateModel( + name='ProductAction', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('timestamp', models.IntegerField()), + ('total_cart', models.IntegerField(default=0)), + ('total_purchase', models.IntegerField(default=0)), + ('product', models.ForeignKey(related_name='actions', to='shop.Product')), + ], + options={ + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='ProductImage', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('_order', models.IntegerField(null=True, verbose_name='Order')), + ('file', models.ImageField(upload_to='product', verbose_name='Image')), + ('description', models.CharField(max_length=100, verbose_name='Description', blank=True)), + ('product', models.ForeignKey(related_name='images', to='shop.Product')), + ], + options={ + 'ordering': ('_order',), + 'verbose_name': 'Image', + 'verbose_name_plural': 'Images', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='ProductOption', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('type', models.IntegerField(verbose_name='Type', choices=[(1, 'Size'), (2, 'Colour')])), + ('name', cartridge.shop.fields.OptionField(max_length=50, null=True, verbose_name='Name')), + ], + options={ + 'verbose_name': 'Product option', + 'verbose_name_plural': 'Product options', + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='ProductVariation', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('unit_price', cartridge.shop.fields.MoneyField(null=True, verbose_name='Unit price', max_digits=10, decimal_places=2, blank=True)), + ('sale_id', models.IntegerField(null=True)), + ('sale_price', cartridge.shop.fields.MoneyField(null=True, verbose_name='Sale price', max_digits=10, decimal_places=2, blank=True)), + ('sale_from', models.DateTimeField(null=True, verbose_name='Sale start', blank=True)), + ('sale_to', models.DateTimeField(null=True, verbose_name='Sale end', blank=True)), + ('sku', cartridge.shop.fields.SKUField(max_length=20, unique=True, null=True, verbose_name='SKU', blank=True)), + ('num_in_stock', models.IntegerField(null=True, verbose_name='Number in stock', blank=True)), + ('default', models.BooleanField(default=False, verbose_name='Default')), + ('option1', cartridge.shop.fields.OptionField(max_length=50, null=True, verbose_name='Size')), + ('option2', cartridge.shop.fields.OptionField(max_length=50, null=True, verbose_name='Colour')), + ('image', models.ForeignKey(verbose_name='Image', blank=True, to='shop.ProductImage', null=True)), + ('product', models.ForeignKey(related_name='variations', to='shop.Product')), + ], + options={ + 'ordering': ('-default',), + }, + bases=(models.Model,), + ), + migrations.CreateModel( + name='Sale', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('title', models.CharField(max_length=100, verbose_name='Title')), + ('active', models.BooleanField(default=False, verbose_name='Active')), + ('discount_deduct', cartridge.shop.fields.MoneyField(null=True, verbose_name='Reduce by amount', max_digits=10, decimal_places=2, blank=True)), + ('discount_percent', cartridge.shop.fields.PercentageField(null=True, verbose_name='Reduce by percent', max_digits=5, decimal_places=2, blank=True)), + ('discount_exact', cartridge.shop.fields.MoneyField(null=True, verbose_name='Reduce to amount', max_digits=10, decimal_places=2, blank=True)), + ('valid_from', models.DateTimeField(null=True, verbose_name='Valid from', blank=True)), + ('valid_to', models.DateTimeField(null=True, verbose_name='Valid to', blank=True)), + ('categories', models.ManyToManyField(related_name='sale_related', verbose_name='Categories', to='shop.Category', blank=True)), + ('products', models.ManyToManyField(to='shop.Product', verbose_name='Products', blank=True)), + ], + options={ + 'verbose_name': 'Sale', + 'verbose_name_plural': 'Sales', + }, + bases=(models.Model,), + ), + migrations.AlterUniqueTogether( + name='productaction', + unique_together=set([('product', 'timestamp')]), + ), + migrations.AddField( + model_name='discountcode', + name='products', + field=models.ManyToManyField(to='shop.Product', verbose_name='Products', blank=True), + preserve_default=True, + ), + migrations.AddField( + model_name='category', + name='options', + field=models.ManyToManyField(related_name='product_options', verbose_name='Product options', to='shop.ProductOption', blank=True), + preserve_default=True, + ), + migrations.AddField( + model_name='category', + name='products', + field=models.ManyToManyField(to='shop.Product', verbose_name='Products', blank=True), + preserve_default=True, + ), + migrations.AddField( + model_name='category', + name='sale', + field=models.ForeignKey(verbose_name='Sale', blank=True, to='shop.Sale', null=True), + preserve_default=True, + ), + ] diff --git a/app/migrations/shop/0002_auto_20141227_1331.py b/app/migrations/shop/0002_auto_20141227_1331.py new file mode 100644 index 00000000..3e738da6 --- /dev/null +++ b/app/migrations/shop/0002_auto_20141227_1331.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import django.db.models.deletion +import mezzanine.core.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('shop', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='productimage', + name='_order', + field=mezzanine.core.fields.OrderField(null=True, verbose_name='Order'), + preserve_default=True, + ), + migrations.AlterField( + model_name='productvariation', + name='image', + field=models.ForeignKey(on_delete=django.db.models.deletion.SET_NULL, verbose_name='Image', blank=True, to='shop.ProductImage', null=True), + preserve_default=True, + ), + ] diff --git a/app/migrations/shop/0003_emailfield.py b/app/migrations/shop/0003_emailfield.py new file mode 100644 index 00000000..61c7c8d9 --- /dev/null +++ b/app/migrations/shop/0003_emailfield.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import mezzanine.pages.managers +import mezzanine.core.managers +import cartridge.shop.managers + + +class Migration(migrations.Migration): + + dependencies = [ + ('shop', '0002_auto_20141227_1331'), + ] + + operations = [ + migrations.AlterField( + model_name='order', + name='billing_detail_email', + field=models.EmailField(max_length=254, verbose_name='Email'), + ), + ] diff --git a/app/migrations/shop/0004_productimage_file_field.py b/app/migrations/shop/0004_productimage_file_field.py new file mode 100644 index 00000000..ce26d93e --- /dev/null +++ b/app/migrations/shop/0004_productimage_file_field.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import mezzanine.core.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('shop', '0003_emailfield'), + ] + + operations = [ + migrations.AlterField( + model_name='productimage', + name='file', + field=mezzanine.core.fields.FileField(verbose_name='Image', max_length=255), + ), + ] diff --git a/app/migrations/shop/0005_auto_20150527_1127.py b/app/migrations/shop/0005_auto_20150527_1127.py new file mode 100644 index 00000000..ebdf1096 --- /dev/null +++ b/app/migrations/shop/0005_auto_20150527_1127.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('shop', '0004_productimage_file_field'), + ] + + operations = [ + migrations.AlterField( + model_name='product', + name='publish_date', + field=models.DateTimeField(help_text="With Published chosen, won't be shown until this time", null=True, verbose_name='Published from', db_index=True, blank=True), + ), + ] diff --git a/app/migrations/shop/0006_auto_20150916_0459.py b/app/migrations/shop/0006_auto_20150916_0459.py new file mode 100644 index 00000000..0b541b51 --- /dev/null +++ b/app/migrations/shop/0006_auto_20150916_0459.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('shop', '0005_auto_20150527_1127'), + ] + + operations = [ + migrations.AlterField( + model_name='order', + name='key', + field=models.CharField(max_length=40, db_index=True), + ), + ] diff --git a/app/migrations/shop/0007_auto_20150921_2323.py b/app/migrations/shop/0007_auto_20150921_2323.py new file mode 100644 index 00000000..7ee6caaa --- /dev/null +++ b/app/migrations/shop/0007_auto_20150921_2323.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations +import cartridge.shop.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('shop', '0006_auto_20150916_0459'), + ] + + operations = [ + migrations.AlterField( + model_name='product', + name='sku', + field=cartridge.shop.fields.SKUField(max_length=20, null=True, verbose_name='SKU', blank=True), + ), + migrations.AlterField( + model_name='productvariation', + name='sku', + field=cartridge.shop.fields.SKUField(max_length=20, null=True, verbose_name='SKU', blank=True), + ), + migrations.AlterUniqueTogether( + name='product', + unique_together=set([('sku', 'site')]), + ), + ] diff --git a/app/migrations/shop/0008_auto_20160907_1726.py b/app/migrations/shop/0008_auto_20160907_1726.py new file mode 100644 index 00000000..245e1807 --- /dev/null +++ b/app/migrations/shop/0008_auto_20160907_1726.py @@ -0,0 +1,107 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-09-07 15:26 +from __future__ import unicode_literals + +import cartridge.shop.fields +from django.db import migrations, models +import mezzanine.core.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('shop', '0007_auto_20150921_2323'), + ] + + operations = [ + migrations.AddField( + model_name='category', + name='content_en', + field=mezzanine.core.fields.RichTextField(null=True, verbose_name='Content'), + ), + migrations.AddField( + model_name='category', + name='content_fr', + field=mezzanine.core.fields.RichTextField(null=True, verbose_name='Content'), + ), + migrations.AddField( + model_name='product', + name='_meta_title_en', + field=models.CharField(blank=True, help_text='Optional title to be used in the HTML title tag. If left blank, the main title field will be used.', max_length=500, null=True, verbose_name='Title'), + ), + migrations.AddField( + model_name='product', + name='_meta_title_fr', + field=models.CharField(blank=True, help_text='Optional title to be used in the HTML title tag. If left blank, the main title field will be used.', max_length=500, null=True, verbose_name='Title'), + ), + migrations.AddField( + model_name='product', + name='content_en', + field=mezzanine.core.fields.RichTextField(null=True, verbose_name='Content'), + ), + migrations.AddField( + model_name='product', + name='content_fr', + field=mezzanine.core.fields.RichTextField(null=True, verbose_name='Content'), + ), + migrations.AddField( + model_name='product', + name='description_en', + field=models.TextField(blank=True, null=True, verbose_name='Description'), + ), + migrations.AddField( + model_name='product', + name='description_fr', + field=models.TextField(blank=True, null=True, verbose_name='Description'), + ), + migrations.AddField( + model_name='product', + name='title_en', + field=models.CharField(max_length=500, null=True, verbose_name='Title'), + ), + migrations.AddField( + model_name='product', + name='title_fr', + field=models.CharField(max_length=500, null=True, verbose_name='Title'), + ), + migrations.AddField( + model_name='productimage', + name='description_en', + field=models.CharField(blank=True, max_length=100, null=True, verbose_name='Description'), + ), + migrations.AddField( + model_name='productimage', + name='description_fr', + field=models.CharField(blank=True, max_length=100, null=True, verbose_name='Description'), + ), + migrations.AddField( + model_name='productoption', + name='name_en', + field=cartridge.shop.fields.OptionField(max_length=50, null=True, verbose_name='Name'), + ), + migrations.AddField( + model_name='productoption', + name='name_fr', + field=cartridge.shop.fields.OptionField(max_length=50, null=True, verbose_name='Name'), + ), + migrations.AddField( + model_name='productvariation', + name='option1_en', + field=cartridge.shop.fields.OptionField(max_length=50, null=True, verbose_name='Size'), + ), + migrations.AddField( + model_name='productvariation', + name='option1_fr', + field=cartridge.shop.fields.OptionField(max_length=50, null=True, verbose_name='Size'), + ), + migrations.AddField( + model_name='productvariation', + name='option2_en', + field=cartridge.shop.fields.OptionField(max_length=50, null=True, verbose_name='Colour'), + ), + migrations.AddField( + model_name='productvariation', + name='option2_fr', + field=cartridge.shop.fields.OptionField(max_length=50, null=True, verbose_name='Colour'), + ), + ] diff --git a/app/migrations/shop/__init__.py b/app/migrations/shop/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/app/organization/products/__init__.py b/app/organization/products/__init__.py new file mode 100644 index 00000000..4500ae1e --- /dev/null +++ b/app/organization/products/__init__.py @@ -0,0 +1,10 @@ +""" +Provides abstract models and admin features used throughout the various +Mezzanine apps. +""" +from __future__ import unicode_literals + +from mezzanine import __version__ # noqa + + +default_app_config = 'organization.products.apps.ProductConfig' diff --git a/app/organization/products/admin.py b/app/organization/products/admin.py new file mode 100644 index 00000000..0d9f2e20 --- /dev/null +++ b/app/organization/products/admin.py @@ -0,0 +1,10 @@ +from copy import deepcopy + +from django.contrib import admin +from django.utils.translation import ugettext_lazy as _ + +from mezzanine.core.admin import * + +from organization.projects.models import * +from organization.pages.models import * +from organization.media.models import Video, Audio diff --git a/app/organization/products/apps.py b/app/organization/products/apps.py new file mode 100644 index 00000000..d198b2d6 --- /dev/null +++ b/app/organization/products/apps.py @@ -0,0 +1,9 @@ +from __future__ import unicode_literals + +from django.apps import AppConfig + + +class ProductConfig(AppConfig): + + name = 'organization.products' + label = 'organization-products' diff --git a/app/organization/products/migrations/__init__.py b/app/organization/products/migrations/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/app/organization/products/models.py b/app/organization/products/models.py new file mode 100644 index 00000000..cd51d4c3 --- /dev/null +++ b/app/organization/products/models.py @@ -0,0 +1,9 @@ +from __future__ import unicode_literals + +from django.db import models +from django.utils.translation import ugettext_lazy as _ + +from mezzanine.core.models import RichText, Displayable, Slugged, Orderable + +from organization.core.models import * +from organization.pages.models import * diff --git a/app/organization/products/tests.py b/app/organization/products/tests.py new file mode 100644 index 00000000..7ce503c2 --- /dev/null +++ b/app/organization/products/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/app/organization/products/translation.py b/app/organization/products/translation.py new file mode 100644 index 00000000..60c2e5d3 --- /dev/null +++ b/app/organization/products/translation.py @@ -0,0 +1,11 @@ +from modeltranslation.translator import translator, register, TranslationOptions + +from organization.projects.models import * + + +# @register(Project) +# class ProjectTranslationOptions(TranslationOptions): +# +# fields = ('title', 'description', 'content') +# +# diff --git a/app/organization/products/urls.py b/app/organization/products/urls.py new file mode 100644 index 00000000..75e2f156 --- /dev/null +++ b/app/organization/products/urls.py @@ -0,0 +1,14 @@ +from __future__ import unicode_literals + +import django.views.i18n +from django.conf.urls import patterns, include, url +from django.conf.urls.i18n import i18n_patterns + +from mezzanine.core.views import direct_to_template +from mezzanine.conf import settings + +from organization.projects.views import * + +urlpatterns = [ + # url("^project/detail/(?P.*)/$", ProjectDetailView.as_view(), name='organization-project-detail'), +] diff --git a/app/organization/products/views.py b/app/organization/products/views.py new file mode 100644 index 00000000..44b18f22 --- /dev/null +++ b/app/organization/products/views.py @@ -0,0 +1,17 @@ +from django.shortcuts import render + +from organization.projects.models import * +from organization.core.views import * + + +# class ProjectListView(ListView): +# +# model = Project +# template_name='projects/project_list.html' +# +# +# class ProjectDetailView(SlugMixin, DetailView): +# +# model = Project +# template_name='projects/project_detail.html' +# context_object_name = 'project' diff --git a/app/organization/projects/migrations/0007_auto_20160907_1718.py b/app/organization/projects/migrations/0007_auto_20160907_1718.py new file mode 100644 index 00000000..aba2a019 --- /dev/null +++ b/app/organization/projects/migrations/0007_auto_20160907_1718.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# Generated by Django 1.9.7 on 2016-09-07 15:18 +from __future__ import unicode_literals + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('organization-projects', '0006_merge'), + ] + + operations = [ + migrations.AlterModelOptions( + name='projectprogram', + options={'verbose_name': 'program'}, + ), + migrations.AlterModelOptions( + name='projectprogramtype', + options={'verbose_name': 'program type'}, + ), + ] diff --git a/app/scripts/app.sh b/app/scripts/app.sh index 82ef0920..78003b6f 100644 --- a/app/scripts/app.sh +++ b/app/scripts/app.sh @@ -18,7 +18,7 @@ gid='www-data' patterns='*.js;*.css;*.jpg;*.jpeg;*.gif;*.png;*.svg;*.ttf;*.eot;*.woff;*.woff2' # Staging -# pip install psycopg2 +# pip install cartridge # pip install -U https://forge.ircam.fr/p/django-eve/source/download/dev/ # pip install -U https://github.com/stephenmcd/grappelli-safe/archive/dynamic_stacked.zip # pip install django-querysetsequence diff --git a/app/settings.py b/app/settings.py index aada6c55..212f20bf 100644 --- a/app/settings.py +++ b/app/settings.py @@ -223,6 +223,7 @@ INSTALLED_APPS = [ # "eve", 'djangobower', "meta", + "cartridge.shop", "mezzanine_agenda", # "orderable", "organization.core", @@ -233,6 +234,7 @@ INSTALLED_APPS = [ "organization.magazine", "organization.projects", "organization.agenda", + "organization.products", ] @@ -250,6 +252,7 @@ MIGRATION_MODULES = { "galleries": "migrations.galleries", "pages": "migrations.pages", "conf": "migrations.conf", + "shop": "migrations.shop", } MODELTRANSLATION_TRANSLATION_FILES = ( @@ -299,6 +302,7 @@ MIDDLEWARE_CLASSES = ( # "mezzanine.core.middleware.SSLRedirectMiddleware", "mezzanine.pages.middleware.PageMiddleware", # "mezzanine.core.middleware.FetchFromCacheMiddleware", + "cartridge.shop.middleware.ShopMiddleware", ) # Store these package names here as they may change in the future since diff --git a/requirements.txt b/requirements.txt index f1dda04a..30aafe41 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,3 +15,4 @@ django-countries django-querysetsequence django-autocomplete-light ipython +cartridge diff --git a/scripts/migrate.sh b/scripts/migrate.sh index b561bbfa..90aaae33 100755 --- a/scripts/migrate.sh +++ b/scripts/migrate.sh @@ -1,3 +1,3 @@ #!/bin/sh -docker-compose run app python /srv/app/manage.py migrate +docker-compose run app python /srv/app/manage.py migrate $1