ajout des foreignKey
This commit is contained in:
parent
bc6eda7a15
commit
8a31d698b5
|
@ -25,6 +25,7 @@ class Company(Model):
|
||||||
nationality = CharField(max_length=50)
|
nationality = CharField(max_length=50)
|
||||||
email = EmailField(max_length=200)
|
email = EmailField(max_length=200)
|
||||||
phone = CharField(max_length=20)
|
phone = CharField(max_length=20)
|
||||||
|
|
||||||
# Foreign keys
|
# Foreign keys
|
||||||
address = ForeignKey(Address)
|
address = ForeignKey(Address)
|
||||||
|
|
||||||
|
@ -46,7 +47,16 @@ class Boat(Model):
|
||||||
picture = ImageField(upload_to=None, height_field=None, width_field=None, max_length=100)
|
picture = ImageField(upload_to=None, height_field=None, width_field=None, max_length=100)
|
||||||
|
|
||||||
# Foreign keys
|
# Foreign keys
|
||||||
insurance = Insurance()
|
boat_insurance = ForeignKey(BoatInsurance)
|
||||||
|
company = ForeignKey(Company)
|
||||||
|
|
||||||
|
class BoatInsurance(Model)
|
||||||
|
contract = IntegerField()
|
||||||
|
date = DateTimeField()
|
||||||
|
|
||||||
|
# Foreign keys
|
||||||
|
insurance = ForeignKey(Insurance)
|
||||||
|
boat = ForeignKey(Boat)
|
||||||
|
|
||||||
|
|
||||||
class Port(Model):
|
class Port(Model):
|
||||||
|
@ -54,6 +64,7 @@ class Port(Model):
|
||||||
|
|
||||||
# Foreign keys
|
# Foreign keys
|
||||||
address = ForeignKey(Address)
|
address = ForeignKey(Address)
|
||||||
|
company = ForeignKey(Company)
|
||||||
|
|
||||||
class Dock(Model):
|
class Dock(Model):
|
||||||
num = CharField(max_length=10)
|
num = CharField(max_length=10)
|
||||||
|
@ -61,21 +72,34 @@ class Dock(Model):
|
||||||
width = DecimalField()
|
width = DecimalField()
|
||||||
depth = DecimalField()
|
depth = DecimalField()
|
||||||
|
|
||||||
|
# Foreign keys
|
||||||
|
port = ForeignKey(Port)
|
||||||
|
|
||||||
class Plug(Model):
|
class Plug(Model):
|
||||||
num = CharField(max_length=10)
|
num = CharField(max_length=10)
|
||||||
amperage = DecimalField()
|
amperage = DecimalField()
|
||||||
voltage = DecimalField()
|
voltage = DecimalField()
|
||||||
|
|
||||||
|
# Foreign keys
|
||||||
|
port = ForeignKey(Port)
|
||||||
|
|
||||||
|
|
||||||
class Tap(Model):
|
class Tap(Model):
|
||||||
num = CharField(max_length=10)
|
num = CharField(max_length=10)
|
||||||
|
|
||||||
|
# Foreign keys
|
||||||
|
port = ForeignKey(Port)
|
||||||
|
|
||||||
class Stay(Model):
|
class Stay(Model):
|
||||||
arrival = DateTimeField()
|
arrival = DateTimeField()
|
||||||
departure = DateTimeField('date published')
|
departure = DateTimeField('date published')
|
||||||
coming_from = CharField(max_length=200)
|
coming_from = CharField(max_length=200)
|
||||||
going_to = CharField(max_length=200)
|
going_to = CharField(max_length=200)
|
||||||
|
|
||||||
|
# Foreign keys
|
||||||
|
boat = ForeignKey(Boat)
|
||||||
|
bill = ForeignKey(Bill)
|
||||||
|
|
||||||
class PaymentType(Model):
|
class PaymentType(Model):
|
||||||
name = CharField(max_length=20)
|
name = CharField(max_length=20)
|
||||||
|
|
||||||
|
@ -84,11 +108,37 @@ class Payment(Model):
|
||||||
date = DateTimeField()
|
date = DateTimeField()
|
||||||
amount = DecimalField()
|
amount = DecimalField()
|
||||||
|
|
||||||
|
# Foreign keys
|
||||||
pay_type = ForeignKey(PaymentType)
|
pay_type = ForeignKey(PaymentType)
|
||||||
|
|
||||||
class Service(Model):
|
class Service(Model):
|
||||||
service_type = CharField(max_length=50)
|
service_type = CharField(max_length=50)
|
||||||
|
|
||||||
class Bill_line(Model):
|
class BillLine(Model):
|
||||||
service = ForeignKey(Service)
|
|
||||||
quantity = DecimalField()
|
quantity = DecimalField()
|
||||||
|
|
||||||
|
# Foreign keys
|
||||||
|
service = ForeignKey(Service)
|
||||||
|
bill = ForeignKey(Bill)
|
||||||
|
|
||||||
|
class Bill(Model):
|
||||||
|
num = IntegerField()
|
||||||
|
date = DateTimeField()
|
||||||
|
total = DecimalField()
|
||||||
|
|
||||||
|
class BillPayment(Model):
|
||||||
|
amount = DecimalField()
|
||||||
|
|
||||||
|
# Foreign keys
|
||||||
|
bill = ForeignKey(Bill)
|
||||||
|
payment = ForeignKey(Payment)
|
||||||
|
|
||||||
|
|
||||||
|
class Mooring(Model):
|
||||||
|
date = DateTimeField()
|
||||||
|
|
||||||
|
# Foreign keys
|
||||||
|
stay = ForeignKey(Stay)
|
||||||
|
dock = ForeignKey(Dock)
|
||||||
|
tap = ForeignKey(Tap)
|
||||||
|
plug = ForeignKey(Plug)
|
||||||
|
|
Loading…
Reference in New Issue