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 =
# Foreign keys
class Company(models.Model): address = ForeignKey(Address)
name =
address = class Company(Model):
siret = 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 = class Stay(Model):
going_to = arrival = DateTimeField()
departure = DateTimeField()
class Payment(models.Model): coming_from = CharField(max_length=150)
num = going_to = CharField(max_length=150)
date = models.DateTimeField('date published')
pay_type = class PaymentType(Model):
amount = name = CharField(max_length=20)
class Bill_line(models.Model): class Payment(Model):
service = num = CharField(max_length=40)
quantity = date = DateTimeField()
pay_type = ForeignKey(PaymentType)
class Service(models.Model): amount = DecimalField()
service_type =
class Service(Model):
service_type = CharField(max_length=50)
# Create your models here.
class Bill_line(Model):
service = Service()
quantity = DecimalField()