84 lines
2.1 KiB
Python
84 lines
2.1 KiB
Python
from django.db import models
|
|
from django.db.models import Model, CharField, EmailField, \
|
|
DateTimeField, DecimalField, ForeignKey
|
|
|
|
class Address(Model):
|
|
address = CharFIELD(MAX_length=254)
|
|
zip_code = CharField(max_length=10)
|
|
city = CharField(max_length=200)
|
|
country = CharField(max_length=200)
|
|
|
|
class Person(Model):
|
|
name = CharField(max_length=50)
|
|
surname = CharField(max_length=50)
|
|
nationality = CharField(max_length=200)
|
|
email = EmailField(max_length=200)
|
|
phone = CharField(max_length=20)
|
|
|
|
# Foreign keys
|
|
address = ForeignKey(Address)
|
|
|
|
class Company(Model):
|
|
name = CharField(max_length=50)
|
|
address = CharField(max_length=254)
|
|
nationality = CharField(max_length=50)
|
|
email = EmailField(max_length=200)
|
|
phone = CharField(max_length=20)
|
|
|
|
class Insurance(Company):
|
|
pass
|
|
|
|
class Boat(Model):
|
|
name = CharField(max_length=50)
|
|
registration_num = CharField(max_length=20)
|
|
length = DecimalField()
|
|
beam = DecimalField()
|
|
water_draught = DecimalField()
|
|
tonnage = DecimalField()
|
|
water_tank = DecimalField()
|
|
model = CharField(max_length=50)
|
|
heating = CharField(max_length=50)
|
|
|
|
# Foreign keys
|
|
insurance = Insurance()
|
|
|
|
class Port(Model):
|
|
name = CharField(max_length=50)
|
|
address = CharField(max_length=254)
|
|
|
|
class Dock(Model):
|
|
num = CharField(max_length=4)
|
|
length = DecimalField()
|
|
width = DecimalField()
|
|
depth = DecimalField()
|
|
|
|
class Plug(Model):
|
|
num = CharField(max_length=4)
|
|
amperage = DecimalField()
|
|
voltage = DecimalField()
|
|
|
|
class Tap(Model):
|
|
num = CharField(max_length=4)
|
|
|
|
class Stay(Model):
|
|
arrival = DateTimeField()
|
|
departure = DateTimeField()
|
|
coming_from = CharField(max_length=150)
|
|
going_to = CharField(max_length=150)
|
|
|
|
class PaymentType(Model):
|
|
name = CharField(max_length=20)
|
|
|
|
class Payment(Model):
|
|
num = CharField(max_length=40)
|
|
date = DateTimeField()
|
|
pay_type = ForeignKey(PaymentType)
|
|
amount = DecimalField()
|
|
|
|
class Service(Model):
|
|
service_type = CharField(max_length=50)
|
|
|
|
class Bill_line(Model):
|
|
service = Service()
|
|
quantity = DecimalField()
|