mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-15 16:57:10 +00:00
CASCADE fixes in data model
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user