added max & min value validator on OrderItem discount

parent 4982d30c
...@@ -38,7 +38,7 @@ class Migration(migrations.Migration): ...@@ -38,7 +38,7 @@ class Migration(migrations.Migration):
('color', models.CharField(choices=[('RED', 'Red'), ('ORANGE', 'Orange'), ('YELLOW', 'Yellow'), ('GREEN', 'Green'), ('BLUE', 'Blue'), ('PURPLE', 'Purple'), ('PINK', 'Pink'), ('BLACK', 'Black')], max_length=20)), ('color', models.CharField(choices=[('RED', 'Red'), ('ORANGE', 'Orange'), ('YELLOW', 'Yellow'), ('GREEN', 'Green'), ('BLUE', 'Blue'), ('PURPLE', 'Purple'), ('PINK', 'Pink'), ('BLACK', 'Black')], max_length=20)),
('quantity', models.IntegerField(default=1, validators=[django.core.validators.MaxValueValidator(99), django.core.validators.MinValueValidator(0)])), ('quantity', models.IntegerField(default=1, validators=[django.core.validators.MaxValueValidator(99), django.core.validators.MinValueValidator(0)])),
('personalization', models.CharField(max_length=254)), ('personalization', models.CharField(max_length=254)),
('discount', models.IntegerField(default=0, editable=False)), ('discount', models.IntegerField(default=0, validators=[django.core.validators.MaxValueValidator(99), django.core.validators.MinValueValidator(0)])),
('discount_price', models.DecimalField(decimal_places=2, default=0, max_digits=12)), ('discount_price', models.DecimalField(decimal_places=2, default=0, max_digits=12)),
('sub_total', models.DecimalField(decimal_places=2, default=0, editable=False, max_digits=12)), ('sub_total', models.DecimalField(decimal_places=2, default=0, editable=False, max_digits=12)),
('is_successful', models.BooleanField(default=True, editable=False)), ('is_successful', models.BooleanField(default=True, editable=False)),
......
...@@ -28,7 +28,7 @@ class OrderItem(models.Model): ...@@ -28,7 +28,7 @@ class OrderItem(models.Model):
("GREEN", "Green"), ("BLUE", "Blue"), ("PURPLE", "Purple"), ("PINK", "Pink"), ("BLACK", "Black"))) ("GREEN", "Green"), ("BLUE", "Blue"), ("PURPLE", "Purple"), ("PINK", "Pink"), ("BLACK", "Black")))
quantity = models.IntegerField(default=1, validators=[MaxValueValidator(99), MinValueValidator(0)]) quantity = models.IntegerField(default=1, validators=[MaxValueValidator(99), MinValueValidator(0)])
personalization = models.CharField(max_length=254) personalization = models.CharField(max_length=254)
discount = models.IntegerField(default=0, editable=False) discount = models.IntegerField(default=0, validators=[MaxValueValidator(100), MinValueValidator(0)])
discount_price = models.DecimalField(default=0, decimal_places=2, max_digits=12) discount_price = models.DecimalField(default=0, decimal_places=2, max_digits=12)
sub_total = models.DecimalField(default=0, editable=False, decimal_places=2, max_digits=12) sub_total = models.DecimalField(default=0, editable=False, decimal_places=2, max_digits=12)
is_successful = models.BooleanField(default=True, editable=False) is_successful = models.BooleanField(default=True, editable=False)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment