Commits

Stephen McDonald committed b6841bd Merge

Merge.

  • Participants
  • Parent commits 10e0c24, 2f83ec8

Comments (0)

Files changed (4)

 .. image:: https://secure.travis-ci.org/stephenmcd/cartridge.png?branch=master
 
+Created by `Stephen McDonald <http://twitter.com/stephen_mcd>`_
+
 ========
 Overview
 ========
 Sites Using Cartridge
 =====================
 
-  * `Ripe Maternity`_
-  * `Cotton On`_
-  * `Coopers Store`_
-  * `Sheer Ethic`_
-  * `tindie.com` <http://tindie.com/>`_
+  * `Ripe Maternity <http://www.ripematernity.com>`_
+  * `Cotton On <http://shop.cottonon.com>`_
+  * `Coopers Store <http://store.coopers.com.au>`_
+  * `Sheer Ethic <http://sheerethic.com>`_
+  * `tindie.com <http://tindie.com>`_
+  * `Ross A. Laird <http://rosslaird.com/shop>`_
+  * `Pink Twig <http://www.pinktwig.ca/shop>`_
 
 .. _`Django`: http://djangoproject.com/
 .. _`BSD licensed`: http://www.linfo.org/bsdlicense.html
 .. _`Github issue tracker`: http://github.com/stephenmcd/cartridge/issues
 .. _`Django coding style`: http://docs.djangoproject.com/en/dev/internals/contributing/#coding-style
 .. _`PEP 8`: http://www.python.org/dev/peps/pep-0008/
-.. _`Ripe Maternity`: http://www.ripematernity.com/
-.. _`Cotton On`: http://shop.cottonon.com/
-.. _`Coopers Store`: http://store.coopers.com.au/
-.. _`Sheer Ethic`: http://sheerethic.com/

File cartridge/shop/fields.py

         super(OptionField, self).__init__(*args, **defaults)
 
 
+class PercentageField(DecimalField):
+    """
+    A field for representing a percentage. Sets restrictions on admin
+    form fields to ensure it is between 0-100.
+    """
+    def formfield(self, *args, **kwargs):
+        defaults = {'min_value': 0, 'max_value': 100}
+        kwargs.update(**defaults)
+        return super(PercentageField, self).formfield(*args, **kwargs)
+
+
 class MoneyField(DecimalField):
     """
     A field for a monetary amount. Provide the default size and

File cartridge/shop/migrations/0012_allow_100_percent_discount.py

+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+
+        # Changing field 'Sale.discount_percent'
+        db.alter_column('shop_sale', 'discount_percent', self.gf('cartridge.shop.fields.PercentageField')(null=True, max_digits=5, decimal_places=2))
+
+        # Changing field 'DiscountCode.discount_percent'
+        db.alter_column('shop_discountcode', 'discount_percent', self.gf('cartridge.shop.fields.PercentageField')(null=True, max_digits=5, decimal_places=2))
+
+    def backwards(self, orm):
+
+        # Changing field 'Sale.discount_percent'
+        db.alter_column('shop_sale', 'discount_percent', self.gf('django.db.models.fields.DecimalField')(null=True, max_digits=4, decimal_places=2))
+
+        # Changing field 'DiscountCode.discount_percent'
+        db.alter_column('shop_discountcode', 'discount_percent', self.gf('django.db.models.fields.DecimalField')(null=True, max_digits=4, decimal_places=2))
+
+    models = {
+        'contenttypes.contenttype': {
+            'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
+            'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
+        },
+        'generic.assignedkeyword': {
+            'Meta': {'ordering': "('_order',)", 'object_name': 'AssignedKeyword'},
+            '_order': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'keyword': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'assignments'", 'to': "orm['generic.Keyword']"}),
+            'object_pk': ('django.db.models.fields.IntegerField', [], {})
+        },
+        'generic.keyword': {
+            'Meta': {'object_name': 'Keyword'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
+            'slug': ('django.db.models.fields.CharField', [], {'max_length': '2000', 'null': 'True', 'blank': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '500'})
+        },
+        'generic.rating': {
+            'Meta': {'object_name': 'Rating'},
+            'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'object_pk': ('django.db.models.fields.IntegerField', [], {}),
+            'value': ('django.db.models.fields.IntegerField', [], {})
+        },
+        'pages.page': {
+            'Meta': {'ordering': "('titles',)", 'object_name': 'Page'},
+            '_order': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
+            'content_model': ('django.db.models.fields.CharField', [], {'max_length': '50', 'null': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'expiry_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'gen_description': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'in_footer': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'in_navigation': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+            'keywords': ('mezzanine.generic.fields.KeywordsField', [], {'object_id_field': "'object_pk'", 'to': "orm['generic.AssignedKeyword']"}),
+            'keywords_string': ('django.db.models.fields.CharField', [], {'max_length': '500', 'blank': 'True'}),
+            'login_required': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['pages.Page']"}),
+            'publish_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'short_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
+            'slug': ('django.db.models.fields.CharField', [], {'max_length': '2000', 'null': 'True', 'blank': 'True'}),
+            'status': ('django.db.models.fields.IntegerField', [], {'default': '2'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
+            'titles': ('django.db.models.fields.CharField', [], {'max_length': '1000', 'null': 'True'})
+        },
+        'shop.cart': {
+            'Meta': {'object_name': 'Cart'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'last_updated': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'})
+        },
+        'shop.cartitem': {
+            'Meta': {'object_name': 'CartItem'},
+            'cart': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'items'", 'to': "orm['shop.Cart']"}),
+            'description': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'image': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True'}),
+            'quantity': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'sku': ('cartridge.shop.fields.SKUField', [], {'max_length': '20'}),
+            'total_price': ('cartridge.shop.fields.MoneyField', [], {'default': "'0'", 'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),
+            'unit_price': ('cartridge.shop.fields.MoneyField', [], {'default': "'0'", 'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),
+            'url': ('django.db.models.fields.CharField', [], {'max_length': '200'})
+        },
+        'shop.category': {
+            'Meta': {'ordering': "('_order',)", 'object_name': 'Category', '_ormbases': ['pages.Page']},
+            'combined': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+            'content': ('mezzanine.core.fields.RichTextField', [], {}),
+            'options': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'product_options'", 'blank': 'True', 'to': "orm['shop.ProductOption']"}),
+            'page_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['pages.Page']", 'unique': 'True', 'primary_key': 'True'}),
+            'price_max': ('cartridge.shop.fields.MoneyField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),
+            'price_min': ('cartridge.shop.fields.MoneyField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),
+            'sale': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['shop.Sale']", 'null': 'True', 'blank': 'True'})
+        },
+        'shop.discountcode': {
+            'Meta': {'object_name': 'DiscountCode'},
+            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'discountcode_related'", 'blank': 'True', 'to': "orm['shop.Category']"}),
+            'code': ('cartridge.shop.fields.DiscountCodeField', [], {'unique': 'True', 'max_length': '20'}),
+            'discount_deduct': ('cartridge.shop.fields.MoneyField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),
+            'discount_exact': ('cartridge.shop.fields.MoneyField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),
+            'discount_percent': ('cartridge.shop.fields.PercentageField', [], {'null': 'True', 'max_digits': '5', 'decimal_places': '2', 'blank': 'True'}),
+            'free_shipping': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'min_purchase': ('cartridge.shop.fields.MoneyField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),
+            'products': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['shop.Product']", 'symmetrical': 'False', 'blank': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'uses_remaining': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+            'valid_from': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'valid_to': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'})
+        },
+        'shop.order': {
+            'Meta': {'ordering': "('-id',)", 'object_name': 'Order'},
+            'additional_instructions': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'billing_detail_city': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'billing_detail_country': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'billing_detail_email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
+            'billing_detail_first_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'billing_detail_last_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'billing_detail_phone': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
+            'billing_detail_postcode': ('django.db.models.fields.CharField', [], {'max_length': '10'}),
+            'billing_detail_state': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'billing_detail_street': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'discount_code': ('cartridge.shop.fields.DiscountCodeField', [], {'max_length': '20', 'blank': 'True'}),
+            'discount_total': ('cartridge.shop.fields.MoneyField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'item_total': ('cartridge.shop.fields.MoneyField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),
+            'key': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
+            'shipping_detail_city': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'shipping_detail_country': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'shipping_detail_first_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'shipping_detail_last_name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'shipping_detail_phone': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
+            'shipping_detail_postcode': ('django.db.models.fields.CharField', [], {'max_length': '10'}),
+            'shipping_detail_state': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'shipping_detail_street': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'shipping_total': ('cartridge.shop.fields.MoneyField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),
+            'shipping_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'blank': 'True'}),
+            'status': ('django.db.models.fields.IntegerField', [], {'default': '1'}),
+            'time': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}),
+            'total': ('cartridge.shop.fields.MoneyField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),
+            'transaction_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
+            'user_id': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
+        },
+        'shop.orderitem': {
+            'Meta': {'object_name': 'OrderItem'},
+            'description': ('django.db.models.fields.CharField', [], {'max_length': '200'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'order': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'items'", 'to': "orm['shop.Order']"}),
+            'quantity': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'sku': ('cartridge.shop.fields.SKUField', [], {'max_length': '20'}),
+            'total_price': ('cartridge.shop.fields.MoneyField', [], {'default': "'0'", 'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),
+            'unit_price': ('cartridge.shop.fields.MoneyField', [], {'default': "'0'", 'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'})
+        },
+        'shop.product': {
+            'Meta': {'object_name': 'Product'},
+            'available': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'products'", 'blank': 'True', 'to': "orm['shop.Category']"}),
+            'content': ('mezzanine.core.fields.RichTextField', [], {}),
+            'date_added': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'null': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'expiry_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'gen_description': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'image': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
+            'keywords': ('mezzanine.generic.fields.KeywordsField', [], {'object_id_field': "'object_pk'", 'to': "orm['generic.AssignedKeyword']"}),
+            'keywords_string': ('django.db.models.fields.CharField', [], {'max_length': '500', 'blank': 'True'}),
+            'publish_date': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'rating': ('mezzanine.generic.fields.RatingField', [], {'object_id_field': "'object_pk'", 'to': "orm['generic.Rating']"}),
+            'rating_average': ('django.db.models.fields.FloatField', [], {'default': '0'}),
+            'rating_count': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'related_products': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'related_products_rel_+'", 'blank': 'True', 'to': "orm['shop.Product']"}),
+            'sale_from': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'sale_id': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
+            'sale_price': ('cartridge.shop.fields.MoneyField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),
+            'sale_to': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'short_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),
+            'site': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['sites.Site']"}),
+            'slug': ('django.db.models.fields.CharField', [], {'max_length': '2000', 'null': 'True', 'blank': 'True'}),
+            'status': ('django.db.models.fields.IntegerField', [], {'default': '2'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '500'}),
+            'unit_price': ('cartridge.shop.fields.MoneyField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),
+            'upsell_products': ('django.db.models.fields.related.ManyToManyField', [], {'related_name': "'upsell_products_rel_+'", 'blank': 'True', 'to': "orm['shop.Product']"})
+        },
+        'shop.productaction': {
+            'Meta': {'unique_together': "(('product', 'timestamp'),)", 'object_name': 'ProductAction'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'product': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'actions'", 'to': "orm['shop.Product']"}),
+            'timestamp': ('django.db.models.fields.IntegerField', [], {}),
+            'total_cart': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'total_purchase': ('django.db.models.fields.IntegerField', [], {'default': '0'})
+        },
+        'shop.productimage': {
+            'Meta': {'ordering': "('_order',)", 'object_name': 'ProductImage'},
+            '_order': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
+            'description': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
+            'file': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'product': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'images'", 'to': "orm['shop.Product']"})
+        },
+        'shop.productoption': {
+            'Meta': {'object_name': 'ProductOption'},
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('cartridge.shop.fields.OptionField', [], {'max_length': '50', 'null': 'True'}),
+            'type': ('django.db.models.fields.IntegerField', [], {})
+        },
+        'shop.productvariation': {
+            'Meta': {'ordering': "('-default',)", 'object_name': 'ProductVariation'},
+            'default': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'image': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['shop.ProductImage']", 'null': 'True', 'blank': 'True'}),
+            'num_in_stock': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+            'option1': ('cartridge.shop.fields.OptionField', [], {'max_length': '50', 'null': 'True'}),
+            'option2': ('cartridge.shop.fields.OptionField', [], {'max_length': '50', 'null': 'True'}),
+            'product': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'variations'", 'to': "orm['shop.Product']"}),
+            'sale_from': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'sale_id': ('django.db.models.fields.IntegerField', [], {'null': 'True'}),
+            'sale_price': ('cartridge.shop.fields.MoneyField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),
+            'sale_to': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'sku': ('cartridge.shop.fields.SKUField', [], {'unique': 'True', 'max_length': '20'}),
+            'unit_price': ('cartridge.shop.fields.MoneyField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'})
+        },
+        'shop.sale': {
+            'Meta': {'object_name': 'Sale'},
+            'active': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'sale_related'", 'blank': 'True', 'to': "orm['shop.Category']"}),
+            'discount_deduct': ('cartridge.shop.fields.MoneyField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),
+            'discount_exact': ('cartridge.shop.fields.MoneyField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),
+            'discount_percent': ('cartridge.shop.fields.PercentageField', [], {'null': 'True', 'max_digits': '5', 'decimal_places': '2', 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'products': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['shop.Product']", 'symmetrical': 'False', 'blank': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'valid_from': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'valid_to': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'})
+        },
+        'sites.site': {
+            'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"},
+            'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
+        }
+    }
+
+    complete_apps = ['shop']

File cartridge/shop/models.py

 
 from django.core.urlresolvers import reverse
 from django.db import models
+from django.db.models.signals import m2m_changed
 from django.db.models import CharField, F, Q
 from django.db.models.base import ModelBase
+from django.dispatch import receiver
 from django.utils.translation import ugettext, ugettext_lazy as _
 
 from mezzanine.conf import settings
                                         related_name="%(class)s_related",
                                         verbose_name=_("Categories"))
     discount_deduct = fields.MoneyField(_("Reduce by amount"))
-    discount_percent = models.DecimalField(_("Reduce by percent"),
-                                           max_digits=4, decimal_places=2,
+    discount_percent = fields.PercentageField(_("Reduce by percent"),
+                                           max_digits=5, decimal_places=2,
                                            blank=True, null=True)
     discount_exact = fields.MoneyField(_("Reduce to amount"))
     valid_from = models.DateTimeField(_("Valid from"), blank=True, null=True)
         verbose_name_plural = _("Sales")
 
     def save(self, *args, **kwargs):
+        super(Sale, self).save(*args, **kwargs)
+        self.update_products()
+
+    def update_products(self):
         """
         Apply sales field value to products and variations according
         to the selected categories and products for the sale.
         """
-        super(Sale, self).save(*args, **kwargs)
         self._clear()
         if self.active:
             extra_filter = {}
             priced_model.objects.filter(sale_id=self.id).update(**update)
 
 
+@receiver(m2m_changed, sender=Sale.products.through)
+def sale_update_products(sender, instance, action, *args, **kwargs):
+    """
+    Signal for updating products for the sale - needed since the
+    products won't be assigned to the sale when it is first saved.
+    """
+    if action == "post_add":
+        instance.update_products()
+
+
 class DiscountCode(Discount):
     """
     A code that can be entered at the checkout process to have a