diff options
Diffstat (limited to 'core/models/logbooks.py')
-rw-r--r-- | core/models/logbooks.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/core/models/logbooks.py b/core/models/logbooks.py index 89abca4..4932a57 100644 --- a/core/models/logbooks.py +++ b/core/models/logbooks.py @@ -17,7 +17,9 @@ todo = """ class CaveSlug(models.Model): - """Moved here to avoid nasty cyclic import error""" + """Moved here to avoid nasty cyclic import error + CASCADE means that if the Cave is deleted, this is too + """ cave = models.ForeignKey("Cave", on_delete=models.CASCADE) slug = models.SlugField(max_length=50, unique=True) @@ -25,12 +27,13 @@ class CaveSlug(models.Model): class LogbookEntry(TroggleModel): - """Single parsed entry from Logbook""" + """Single parsed entry from Logbook + Gets deleted if the Expedition gets deleted""" date = ( models.DateField() ) # MJG wants to turn this into a datetime such that multiple Logbook entries on the same day can be ordered.ld() - expedition = models.ForeignKey(Expedition, blank=True, null=True, on_delete=models.SET_NULL) # yes this is double- + expedition = models.ForeignKey(Expedition, blank=True, null=True, on_delete=models.CASCADE) # yes this is double- title = models.CharField(max_length=200) cave_slug = models.SlugField(max_length=50, blank=True, null=True) place = models.CharField( @@ -84,6 +87,9 @@ class LogbookEntry(TroggleModel): class PersonLogEntry(TroggleModel): """Single Person going on a trip, which may or may not be written up. It could account for different T/U for people in same logbook entry. + + CASCADE means that if the personexpedition or the logbookentry is deleted, + then this PersonLogEntry is deleted too """ personexpedition = models.ForeignKey("PersonExpedition", null=True, on_delete=models.CASCADE) |