Ticket #27498: models.py

File models.py, 502 bytes (added by Tim Düllmann, 7 years ago)
Line 
1from django.db import models
2
3
4class Product(models.Model):
5 name = models.CharField(max_length=80)
6 qty_target = models.DecimalField(max_digits=6, decimal_places=2)
7
8 def __str__(self):
9 return self.name
10
11
12class Stock(models.Model):
13 product = models.ForeignKey(Product, related_name="stock")
14 qty_available = models.DecimalField(max_digits=6, decimal_places=2)
15
16 def __str__(self):
17 return self.product.name + " " + str(self.id) + " " + str(self.qty_available) + "ea"
Back to Top