From f22e788cae5381da27e3417b565437a348781b44 Mon Sep 17 00:00:00 2001
From: Lukas Schneider <lukas.s.schneider@fau.de>
Date: Wed, 25 Sep 2019 11:25:17 +0200
Subject: [PATCH] Add default value for product.stock

---
 store/models.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/store/models.py b/store/models.py
index c8b7baa..ad83c86 100644
--- a/store/models.py
+++ b/store/models.py
@@ -52,7 +52,7 @@ class UserIdentifier(models.Model):
 class Product(models.Model):
     name = models.TextField(null=False)
     category = models.ForeignKey('productcategory', on_delete=models.CASCADE, related_name="products")
-    stock = models.IntegerField(null=False)
+    stock = models.IntegerField(null=False, default=0)
     price = models.DecimalField(max_digits=6, decimal_places=2)
 
     def updateStock(self, amount):
-- 
GitLab