finish model relations
This commit is contained in:
parent
2c6c6cdc15
commit
16d90b9551
|
@ -84,6 +84,18 @@ class Port(Model):
|
||||||
# Foreign keys
|
# Foreign keys
|
||||||
address = ForeignKey(Address)
|
address = ForeignKey(Address)
|
||||||
company = ForeignKey(Company)
|
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):
|
class Dock(Model):
|
||||||
num = CharField(max_length=10)
|
num = CharField(max_length=10)
|
||||||
|
@ -111,7 +123,7 @@ class Tap(Model):
|
||||||
|
|
||||||
class Stay(Model):
|
class Stay(Model):
|
||||||
arrival = DateTimeField()
|
arrival = DateTimeField()
|
||||||
departure = DateTimeField('date published')
|
departure = DateTimeField()
|
||||||
coming_from = CharField(max_length=200)
|
coming_from = CharField(max_length=200)
|
||||||
going_to = CharField(max_length=200)
|
going_to = CharField(max_length=200)
|
||||||
|
|
||||||
|
@ -131,12 +143,12 @@ class Payment(Model):
|
||||||
pay_type = ForeignKey(PaymentType)
|
pay_type = ForeignKey(PaymentType)
|
||||||
|
|
||||||
class Service(Model):
|
class Service(Model):
|
||||||
service_type = CharField(max_length=50)
|
name = CharField(max_length=50)
|
||||||
|
|
||||||
class BillLine(Model):
|
class BillLine(Model):
|
||||||
quantity = DecimalField()
|
quantity = DecimalField()
|
||||||
|
|
||||||
# Foreign keys
|
# Foreign keyks
|
||||||
service = ForeignKey(Service)
|
service = ForeignKey(Service)
|
||||||
bill = ForeignKey(Bill)
|
bill = ForeignKey(Bill)
|
||||||
|
|
||||||
|
@ -145,6 +157,14 @@ class Bill(Model):
|
||||||
date = DateTimeField()
|
date = DateTimeField()
|
||||||
total = DecimalField()
|
total = DecimalField()
|
||||||
|
|
||||||
|
# Foreign keys
|
||||||
|
payments = ManyToManyField(
|
||||||
|
Payment,
|
||||||
|
through='BillPayment',
|
||||||
|
through_fields=('bill', 'payment')
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class BillPayment(Model):
|
class BillPayment(Model):
|
||||||
amount = DecimalField()
|
amount = DecimalField()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue