Skip to content
Snippets Groups Projects
Commit 6b65f555 authored by Christian Dresen's avatar Christian Dresen
Browse files

[WarpPay] Added Position to Category and to Products

parent 24efef4c
No related branches found
No related tags found
No related merge requests found
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment