aboutsummaryrefslogtreecommitdiff
path: root/app/dispatch/models.py
blob: acb13cdac749e713fbf23e1ebefc7cfcf351587e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
from django.db import models
from django.conf import settings
from auditlog.registry import auditlog

# 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)
    contact_name    = models.CharField(max_length=256)

    def __str__(self):
        return self.name

class Load(models.Model):
    load_number     = models.CharField(max_length=64,default="")
    date            = models.DateField()
    user            = models.ForeignKey(settings.AUTH_USER_MODEL)
    company         = models.ForeignKey(Company)
    description     = models.CharField(max_length=256)
    amount          = models.DecimalField(max_digits=10,decimal_places=2, default="0")

    def __str__(self):
        return "{c}, {d} ( {a} )".format(c=self.company, d=self.description, a=self.amount)

class Paperwork(models.Model):
    load            = models.OneToOneField(Load)
    description     = models.CharField(max_length=256)
    document        = models.FileField(upload_to='paperwork/')

    def __str__(self):
        return "%s" % Load




auditlog.register(Company)
auditlog.register(Load)