diff options
Diffstat (limited to 'app/dispatch/models.py')
| -rw-r--r-- | app/dispatch/models.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/app/dispatch/models.py b/app/dispatch/models.py new file mode 100644 index 0000000..16703fd --- /dev/null +++ b/app/dispatch/models.py @@ -0,0 +1,46 @@ +from django.db import models +from django.conf import settings + +# Create your models here. + +class Company(models.Model): + name = models.CharField(max_length=256) + address = models.CharField(max_length=256) + phone_number = models.DecimalField(max_digits=16,decimal_places=0) + email_address = models.CharField(max_length=256) + primary_contact = models.ForeignKey('Contact', blank=True, null=True) + + def __str__(self): + return self.name + +class Contact(models.Model): + first_name = models.CharField(max_length=64) + last_name = models.CharField(max_length=64) + phone_number = models.DecimalField(max_digits=16,decimal_places=0) + email_address = models.CharField(max_length=256) + works_for = models.ForeignKey(Company) + + def __str__(self): + return "{f} {l} ( {c} )".format(c=self.works_for, f=self.first_name, l=self.last_name) + +class Load(models.Model): + date = models.DateField() + user = models.OneToOneField(settings.AUTH_USER_MODEL) + company = models.OneToOneField(Company) + description = models.CharField(max_length=256) + amount = models.DecimalField(max_digits=10,decimal_places=2) + + def __str__(self): + return "{c}, {d} ( {a} )".format(c=self.company, d=self.description, a=self.amount) + +# class Paperwork(models.Model): +# company = models.OneToOneField(Company) +# description = models.CharField(max_length=256) +# amount = models.DecimalField(max_digits=10,decimal_places=2) +# +# def __str__(self): +# return "{c}, {d} ( {a} )".format(c=self.company, d=self.description, a=self.amount) + + + + |
