Fixes error in EnablingConditionBase, adds admins for Product and Category enabling conditions

This commit is contained in:
Christopher Neugebauer 2016-03-04 14:28:58 -08:00
parent 0182a32f03
commit 8400da17da
3 changed files with 18 additions and 4 deletions

View file

@ -80,3 +80,15 @@ class VoucherAdmin(nested_admin.NestedAdmin):
VoucherDiscountInline,
VoucherEnablingConditionInline,
]
# Enabling conditions
@admin.register(rego.ProductEnablingCondition)
class ProductEnablingConditionAdmin(nested_admin.NestedAdmin):
model = rego.ProductEnablingCondition
# Enabling conditions
@admin.register(rego.CategoryEnablingCondition)
class CategoryEnablingConditionAdmin(nested_admin.NestedAdmin):
model = rego.CategoryEnablingCondition

View file

@ -9,6 +9,8 @@ from django.conf import settings
class Migration(migrations.Migration):
replaces = [('registrasion', '0001_initial'), ('registrasion', '0002_auto_20160304_1723')]
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
@ -225,12 +227,12 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='enablingconditionbase',
name='categories',
field=models.ManyToManyField(to=b'registrasion.Category'),
field=models.ManyToManyField(to=b'registrasion.Category', blank=True),
),
migrations.AddField(
model_name='enablingconditionbase',
name='products',
field=models.ManyToManyField(to=b'registrasion.Product'),
field=models.ManyToManyField(to=b'registrasion.Product', blank=True),
),
migrations.AddField(
model_name='discountitem',

View file

@ -257,8 +257,8 @@ class EnablingConditionBase(models.Model):
description = models.CharField(max_length=255)
mandatory = models.BooleanField(default=False)
products = models.ManyToManyField(Product)
categories = models.ManyToManyField(Category)
products = models.ManyToManyField(Product, blank=True)
categories = models.ManyToManyField(Category, blank=True)
class TimeOrStockLimitEnablingCondition(EnablingConditionBase):