gpp/port/models.py

84 lines
2.1 KiB
Python
Raw Normal View History

2019-05-27 08:04:29 +02:00
from django.db import models
2019-05-31 11:16:49 +02:00
from django.db.models import Model, CharField, EmailField, \
DateTimeField, DecimalField, ForeignKey
2019-05-27 08:04:29 +02:00
2019-05-31 11:16:49 +02:00
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)
2019-05-27 08:04:29 +02:00
class Insurance(Company):
pass
2019-05-31 11:16:49 +02:00
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()