Don't cascade delete
This commit is contained in:
parent
34eae84f24
commit
fd49f7d90e
|
@ -5,7 +5,7 @@ from django.core.validators import RegexValidator
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
class UserInfo(models.Model):
|
class UserInfo(models.Model):
|
||||||
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
user = models.OneToOneField(User)
|
||||||
phone_regex = RegexValidator(regex=r'^\+?1?\d{9,15}$', message="Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed.")
|
phone_regex = RegexValidator(regex=r'^\+?1?\d{9,15}$', message="Phone number must be entered in the format: '+999999999'. Up to 15 digits allowed.")
|
||||||
phone_number = models.CharField(validators=[phone_regex], max_length=16)
|
phone_number = models.CharField(validators=[phone_regex], max_length=16)
|
||||||
|
|
||||||
|
@ -13,14 +13,14 @@ class UserInfo(models.Model):
|
||||||
return 'UserInfo: ' + self.user.username
|
return 'UserInfo: ' + self.user.username
|
||||||
|
|
||||||
class Client(models.Model):
|
class Client(models.Model):
|
||||||
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
user = models.OneToOneField(User)
|
||||||
business_number = models.CharField(max_length=16)
|
business_number = models.CharField(max_length=16)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.user.first_name + ' ' + self.user.last_name
|
return self.user.first_name + ' ' + self.user.last_name
|
||||||
|
|
||||||
class Provider(models.Model):
|
class Provider(models.Model):
|
||||||
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
user = models.OneToOneField(User)
|
||||||
sin = models.CharField(max_length=16)
|
sin = models.CharField(max_length=16)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -28,7 +28,7 @@ class Provider(models.Model):
|
||||||
|
|
||||||
class WorkType(models.Model):
|
class WorkType(models.Model):
|
||||||
uuid = models.UUIDField(default=uuid.uuid4, editable=False)
|
uuid = models.UUIDField(default=uuid.uuid4, editable=False)
|
||||||
client = models.ForeignKey(Client, related_name='work_types', on_delete=models.CASCADE)
|
client = models.ForeignKey(Client, related_name='work_types')
|
||||||
color = models.CharField(max_length=16)
|
color = models.CharField(max_length=16)
|
||||||
label = models.CharField(max_length=100)
|
label = models.CharField(max_length=100)
|
||||||
deleted = models.BooleanField(default=False)
|
deleted = models.BooleanField(default=False)
|
||||||
|
@ -38,8 +38,8 @@ class WorkType(models.Model):
|
||||||
|
|
||||||
class Manage(models.Model):
|
class Manage(models.Model):
|
||||||
uuid = models.UUIDField(default=uuid.uuid4, editable=False)
|
uuid = models.UUIDField(default=uuid.uuid4, editable=False)
|
||||||
client = models.ForeignKey(Client, related_name='employees', on_delete=models.CASCADE)
|
client = models.ForeignKey(Client, related_name='employees')
|
||||||
provider = models.ForeignKey(Provider, related_name='employers', on_delete=models.CASCADE)
|
provider = models.ForeignKey(Provider, related_name='employers')
|
||||||
note = models.CharField(max_length=500, blank=True)
|
note = models.CharField(max_length=500, blank=True)
|
||||||
approved = models.NullBooleanField(blank=True)
|
approved = models.NullBooleanField(blank=True)
|
||||||
deleted = models.BooleanField(default=False)
|
deleted = models.BooleanField(default=False)
|
||||||
|
@ -49,14 +49,14 @@ class Manage(models.Model):
|
||||||
|
|
||||||
class Price(models.Model):
|
class Price(models.Model):
|
||||||
uuid = models.UUIDField(default=uuid.uuid4, editable=False)
|
uuid = models.UUIDField(default=uuid.uuid4, editable=False)
|
||||||
management = models.ForeignKey(Manage, related_name='prices', on_delete=models.CASCADE)
|
management = models.ForeignKey(Manage, related_name='prices')
|
||||||
work_type = models.ForeignKey(WorkType, on_delete=models.CASCADE)
|
work_type = models.ForeignKey(WorkType, on_delete=models.CASCADE)
|
||||||
amount = models.DecimalField(max_digits=8, decimal_places=2)
|
amount = models.DecimalField(max_digits=8, decimal_places=2)
|
||||||
deleted = models.BooleanField(default=False)
|
deleted = models.BooleanField(default=False)
|
||||||
|
|
||||||
class Shift(models.Model):
|
class Shift(models.Model):
|
||||||
uuid = models.UUIDField(default=uuid.uuid4, editable=False)
|
uuid = models.UUIDField(default=uuid.uuid4, editable=False)
|
||||||
price = models.ForeignKey(Price, on_delete=models.CASCADE)
|
price = models.ForeignKey(Price)
|
||||||
set_price = models.DecimalField(max_digits=8, decimal_places=2, null=True)
|
set_price = models.DecimalField(max_digits=8, decimal_places=2, null=True)
|
||||||
set_start = models.DateTimeField(null=True)
|
set_start = models.DateTimeField(null=True)
|
||||||
set_end = models.DateTimeField(null=True)
|
set_end = models.DateTimeField(null=True)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user