summaryrefslogtreecommitdiff
path: root/procurement/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'procurement/models.py')
-rw-r--r--procurement/models.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/procurement/models.py b/procurement/models.py
index 1e70736..43e5a07 100644
--- a/procurement/models.py
+++ b/procurement/models.py
@@ -51,19 +51,25 @@ class DashboardModel(models.Model):
base_string = 'updated {quantity:.2f} {units} ago'
return base_string.format(quantity=quantity, units=units)
-
class Supplier(DashboardModel):
"""
Model which represents an individual or organisation which supplies components
"""
name = models.CharField(max_length=255)
- representative_name = models.CharField(max_length=255, null=True, blank=True)
- representative_email = models.EmailField(max_length=255, null=True, blank=True)
is_authorized = models.BooleanField()
def __str__(self):
return '{}'.format(self.name)
+class Representative(DashboardModel):
+ """Model which represents a single Representative, each supplier
+ can have multiple representatives"""
+ name = models.CharField(max_length=255)
+ email = models.CharField(max_length=255)
+ supplier = models.ForeignKey(Supplier, on_delete=models.CASCADE, related_name="representatives", null=True, blank=True)
+
+ def __str__(self):
+ return '{} <{}>'.format(self.name, self.email)
class Component(DashboardModel):
"""