2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-15 12:27:05 +00:00

CASCADE fixes in data model

This commit is contained in:
2023-03-06 16:37:38 +00:00
parent ccfc44a423
commit 94e145adce
5 changed files with 56 additions and 24 deletions

View File

@@ -59,6 +59,9 @@ class Area(TroggleModel):
class CaveAndEntrance(models.Model):
"""CASCADE means that if the cave or the entrance is deleted, then this CaveAndEntrance
is deleted too
"""
cave = models.ForeignKey("Cave", on_delete=models.CASCADE)
entrance = models.ForeignKey("Entrance", on_delete=models.CASCADE)
entrance_letter = models.CharField(max_length=20, blank=True, null=True)
@@ -240,6 +243,8 @@ class Cave(TroggleModel):
class EntranceSlug(models.Model):
"""If the Entrance is deleted, then this EntranceSlug is deleted too
"""
entrance = models.ForeignKey("Entrance", on_delete=models.CASCADE)
slug = models.SlugField(max_length=50, unique=True)
primary = models.BooleanField(default=False)