mirror of
https://github.com/ae-utbm/sith.git
synced 2024-12-22 15:51:19 +00:00
django2.2: add default mandatory on_delete on OneToOneField
This commit is contained in:
parent
4dadb1dbc0
commit
6cc234e8d3
@ -352,6 +352,7 @@ class Operation(models.Model):
|
||||
null=True,
|
||||
blank=True,
|
||||
default=None,
|
||||
on_delete=models.CASCADE,
|
||||
)
|
||||
|
||||
class Meta:
|
||||
|
@ -96,7 +96,9 @@ class Club(models.Model):
|
||||
blank=True,
|
||||
on_delete=models.SET_NULL,
|
||||
)
|
||||
page = models.OneToOneField(Page, related_name="club", blank=True, null=True)
|
||||
page = models.OneToOneField(
|
||||
Page, related_name="club", blank=True, null=True, on_delete=models.CASCADE
|
||||
)
|
||||
|
||||
class Meta:
|
||||
ordering = ["name", "unix_name"]
|
||||
|
@ -51,7 +51,7 @@ class Customer(models.Model):
|
||||
is used by other accounting classes as reference to the customer, rather than using User
|
||||
"""
|
||||
|
||||
user = models.OneToOneField(User, primary_key=True)
|
||||
user = models.OneToOneField(User, primary_key=True, on_delete=models.CASCADE)
|
||||
account_id = models.CharField(_("account id"), max_length=10, unique=True)
|
||||
amount = CurrencyField(_("amount"))
|
||||
recorded_products = models.IntegerField(_("recorded product"), default=0)
|
||||
@ -727,7 +727,10 @@ class Eticket(models.Model):
|
||||
"""
|
||||
|
||||
product = models.OneToOneField(
|
||||
Product, related_name="eticket", verbose_name=_("product")
|
||||
Product,
|
||||
related_name="eticket",
|
||||
verbose_name=_("product"),
|
||||
on_delete=models.CASCADE,
|
||||
)
|
||||
banner = models.ImageField(
|
||||
upload_to="etickets", null=True, blank=True, verbose_name=_("banner")
|
||||
|
@ -421,7 +421,9 @@ class ForumUserInfo(models.Model):
|
||||
user, such as the favourite topics, the signature, and so on...
|
||||
"""
|
||||
|
||||
user = models.OneToOneField(User, related_name="_forum_infos")
|
||||
user = models.OneToOneField(
|
||||
User, related_name="_forum_infos", on_delete=models.CASCADE
|
||||
)
|
||||
last_read_date = models.DateTimeField(
|
||||
_("last read date"),
|
||||
default=datetime(
|
||||
|
@ -37,7 +37,10 @@ from club.models import Club
|
||||
class Launderette(models.Model):
|
||||
name = models.CharField(_("name"), max_length=30)
|
||||
counter = models.OneToOneField(
|
||||
Counter, verbose_name=_("counter"), related_name="launderette"
|
||||
Counter,
|
||||
verbose_name=_("counter"),
|
||||
related_name="launderette",
|
||||
on_delete=models.CASCADE,
|
||||
)
|
||||
|
||||
class Meta:
|
||||
|
@ -39,7 +39,10 @@ class Stock(models.Model):
|
||||
|
||||
name = models.CharField(_("name"), max_length=64)
|
||||
counter = models.OneToOneField(
|
||||
Counter, verbose_name=_("counter"), related_name="stock"
|
||||
Counter,
|
||||
verbose_name=_("counter"),
|
||||
related_name="stock",
|
||||
on_delete=models.CASCADE,
|
||||
)
|
||||
|
||||
def __str__(self):
|
||||
|
@ -80,7 +80,7 @@ class Trombi(models.Model):
|
||||
show_profiles = models.BooleanField(
|
||||
_("show users profiles to each other"), default=True
|
||||
)
|
||||
club = models.OneToOneField(Club, related_name="trombi")
|
||||
club = models.OneToOneField(Club, related_name="trombi", on_delete=models.CASCADE)
|
||||
|
||||
objects = TrombiManager()
|
||||
availables = AvailableTrombiManager()
|
||||
@ -117,7 +117,10 @@ class TrombiUser(models.Model):
|
||||
"""
|
||||
|
||||
user = models.OneToOneField(
|
||||
User, verbose_name=_("trombi user"), related_name="trombi_user"
|
||||
User,
|
||||
verbose_name=_("trombi user"),
|
||||
related_name="trombi_user",
|
||||
on_delete=models.CASCADE,
|
||||
)
|
||||
trombi = models.ForeignKey(
|
||||
Trombi,
|
||||
|
Loading…
Reference in New Issue
Block a user