diff --git a/port/models.py b/port/models.py index 8c07eb5..69fda08 100644 --- a/port/models.py +++ b/port/models.py @@ -1,77 +1,94 @@ from django.db import models +from django.db.models import Model, CharField, EmailField, \ + DateTimeField, DecimalField, ForeignKey -class Address(models.Model): - address = models.CharField(max_length=200) - zip_code = models.CharField(max_length=200) - city = models.CharField(max_length=200) - country = models.CharField(max_length=200) +class Address(Model): + address = CharField(max_length=200) + zip_code = CharField(max_length=10) + city = CharField(max_length=200) + country = CharField(max_length=200) -class Person(models.Model): - name = models.CharField(max_length=200) - surname = models.CharField(max_length=200) - address = Address() - nationality = models.CharField(max_length=200) - email = models.EmailField(max_length=254) - phone = - -class Company(models.Model): - name = models.CharField(max_length=200) +class Person(Model): + name = CharField(max_length=50) + surname = CharField(max_length=50) address = Address() + nationality = CharField(max_length=200) + email = EmailField(max_length=254) + 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) + # Foreign keys + address = ForeignKey(Address) + class Insurance(Company): pass -class Boat(models.Model): - name = models.CharField(max_length=200) - registration_num = - length = - beam = - water_draught = - tonnage = - water_tank = - model = models.CharField(max_length=200) - heating = models.CharField(max_length=200) - passenger_capacity = - picture = models.ImageField(upload_to=None, height_field=None, width_field=None, max_length=100) +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) + passenger_capacity = IntegerField() + picture = ImageField(upload_to=None, height_field=None, width_field=None, max_length=100) -class Port(models.Model): - name = models.CharField(max_length=200) - address = Address() + # Foreign keys + insurance = Insurance() -class Dock(models.Model): - num = - length = - width = - depth = -class Plug(models.Model): - num = - amperage = - voltage = +class Port(Model): + name = CharField(max_length=50) -class Tap(models.Model): - num = + # Foreign keys + address = ForeignKey(Address) -class Stay(models.Model): - arrival = models.DateTimeField('date published') - departure = models.DateTimeField('date published') - coming_from = models.CharField(max_length=200) - going_to = models.CharField(max_length=200) - num_passenger = - num_guest = - -class Payment(models.Model): - num = - date = models.DateTimeField('date published') - pay_type = models.CharField(max_length=200) - amount = - -class Bill_line(models.Model): - service = models.CharField(max_length=200) - quantity = - -class Service(models.Model): - service_type = models.CharField(max_length=200) - - -# Create your models here. +class Dock(Model): + num = CharField(max_length=10) + length = DecimalField() + width = DecimalField() + depth = DecimalField() + +class Plug(Model): + num = CharField(max_length=10) + amperage = DecimalField() + voltage = DecimalField() + + +class Tap(Model): + num = CharField(max_length=10) + +class Stay(Model): + arrival = DateTimeField() + departure = DateTimeField('date published') + coming_from = CharField(max_length=200) + going_to = CharField(max_length=200) + +class PaymentType(Model): + name = CharField(max_length=20) + +class Payment(Model): + num = CharField(max_length=40) + date = DateTimeField() + amount = DecimalField() + + pay_type = ForeignKey(PaymentType) + +class Service(Model): + service_type = CharField(max_length=50) + +class Bill_line(Model): + service = ForeignKey(Service) + quantity = DecimalField()