diff --git a/www/web/warppay/models.py b/www/web/warppay/models.py index 3136e298096a5d1df258f5a0b989144b56156fae..b9969c49c5c5d1a47b7c776792bd764cdc5102c2 100644 --- a/www/web/warppay/models.py +++ b/www/web/warppay/models.py @@ -6,21 +6,23 @@ from warpauth.models import LdapUser class ProductCategory(models.Model): name = models.CharField(max_length=100, unique=True) + position = models.FloatField(null=True, blank=True, default=0) def __str__(self): return self.name class ProductCategorySerializer(serializers.ModelSerializer): class Meta: model = ProductCategory - fields = ['id', 'name'] + fields = ['id', 'name','position'] class Product(models.Model): name = models.CharField(max_length=100, null=True) price_ek = models.FloatField() price_vk = models.FloatField() category = models.ForeignKey(ProductCategory, on_delete=models.CASCADE, null=True) - stock_count = models.IntegerField() - barcode = models.CharField(max_length=100, null=True) + stock_count = models.IntegerField(null=True, blank=True, default=0) + barcode = models.CharField(max_length=100, null=True, blank=True) + position = models.FloatField(null=True, blank=True, default=0) def __str__(self): return self.name @@ -30,7 +32,7 @@ class ProductSerializer(serializers.ModelSerializer): category = serializers.StringRelatedField() class Meta: model = Product - fields = ['id', 'name', 'price_vk', 'category', 'barcode','stock_count'] + fields = ['id', 'name', 'price_vk', 'category', 'barcode','stock_count','position'] class Transaction(models.Model):