ajout des types de champ

This commit is contained in:
maxime 2019-05-31 11:16:49 +02:00
parent 373a1133de
commit aa72819840
1 changed files with 71 additions and 62 deletions

View File

@ -1,74 +1,83 @@
from django.db import models from django.db import models
from django.db.models import Model, CharField, EmailField, \
DateTimeField, DecimalField, ForeignKey
class Address(models.Model): class Address(Model):
address = address = CharFIELD(MAX_length=254)
zip_code = zip_code = CharField(max_length=10)
city = city = CharField(max_length=200)
country = country = CharField(max_length=200)
class Person(models.Model): class Person(Model):
name = models.CharField(max_length=200) name = CharField(max_length=50)
surname = models.CharField(max_length=200) surname = CharField(max_length=50)
address = nationality = CharField(max_length=200)
nationality = email = EmailField(max_length=200)
email = phone = CharField(max_length=20)
phone =
class Company(models.Model): # Foreign keys
name = address = ForeignKey(Address)
address =
siret = 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): class Insurance(Company):
pass pass
class Boat(models.Model): class Boat(Model):
name = name = CharField(max_length=50)
registration_num = registration_num = CharField(max_length=20)
length = length = DecimalField()
beam = beam = DecimalField()
water_draught = water_draught = DecimalField()
tonnage = tonnage = DecimalField()
water_tank = water_tank = DecimalField()
model = model = CharField(max_length=50)
heating = heating = CharField(max_length=50)
class Port(models.Model): # Foreign keys
name = insurance = Insurance()
address =
class Dock(models.Model): class Port(Model):
num = name = CharField(max_length=50)
length = address = CharField(max_length=254)
width =
depth =
class Plug(models.Model): class Dock(Model):
num = num = CharField(max_length=4)
amperage = length = DecimalField()
voltage = width = DecimalField()
depth = DecimalField()
class Tap(models.Model): class Plug(Model):
num = num = CharField(max_length=4)
amperage = DecimalField()
voltage = DecimalField()
class Stay(models.Model): class Tap(Model):
arrival = models.DateTimeField('date published') num = CharField(max_length=4)
departure = models.DateTimeField('date published')
coming_from =
going_to =
class Payment(models.Model): class Stay(Model):
num = arrival = DateTimeField()
date = models.DateTimeField('date published') departure = DateTimeField()
pay_type = coming_from = CharField(max_length=150)
amount = going_to = CharField(max_length=150)
class Bill_line(models.Model): class PaymentType(Model):
service = name = CharField(max_length=20)
quantity =
class Service(models.Model): class Payment(Model):
service_type = num = CharField(max_length=40)
date = DateTimeField()
pay_type = ForeignKey(PaymentType)
amount = DecimalField()
class Service(Model):
service_type = CharField(max_length=50)
# Create your models here. class Bill_line(Model):
service = Service()
quantity = DecimalField()