diff --git a/port/models.py b/port/models.py index 6ad5c45..580c80f 100644 --- a/port/models.py +++ b/port/models.py @@ -84,6 +84,18 @@ class Port(Model): # Foreign keys address = ForeignKey(Address) company = ForeignKey(Company) + employees = ManyToManyField( + Person, + through='Employee', + through_fields=('port', 'person') + ) + +class Employee(Model): + position = CharField('Job', max_length=20) + + # Foreign keys + port = ForeignKey(Port) + person = ForeignKey(Person) class Dock(Model): num = CharField(max_length=10) @@ -111,7 +123,7 @@ class Tap(Model): class Stay(Model): arrival = DateTimeField() - departure = DateTimeField('date published') + departure = DateTimeField() coming_from = CharField(max_length=200) going_to = CharField(max_length=200) @@ -131,12 +143,12 @@ class Payment(Model): pay_type = ForeignKey(PaymentType) class Service(Model): - service_type = CharField(max_length=50) + name = CharField(max_length=50) class BillLine(Model): quantity = DecimalField() - # Foreign keys + # Foreign keyks service = ForeignKey(Service) bill = ForeignKey(Bill) @@ -145,6 +157,14 @@ class Bill(Model): date = DateTimeField() total = DecimalField() + # Foreign keys + payments = ManyToManyField( + Payment, + through='BillPayment', + through_fields=('bill', 'payment') + ) + + class BillPayment(Model): amount = DecimalField()