diff options
Diffstat (limited to 'core/models/survex.py')
-rw-r--r-- | core/models/survex.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/models/survex.py b/core/models/survex.py index fabc381..7160893 100644 --- a/core/models/survex.py +++ b/core/models/survex.py @@ -199,17 +199,17 @@ class SurvexBlock(models.Model): objects = SurvexBlockLookUpManager() # overwrites SurvexBlock.objects and enables lookup() name = models.CharField(max_length=100) title = models.CharField(max_length=200) - parent = models.ForeignKey("SurvexBlock", blank=True, null=True, on_delete=models.SET_NULL) + parent = models.ForeignKey("SurvexBlock", blank=True, null=True, on_delete=models.SET_NULL, db_index=True) date = models.DateField(blank=True, null=True) - expedition = models.ForeignKey("Expedition", blank=True, null=True, on_delete=models.SET_NULL) + expedition = models.ForeignKey("Expedition", blank=True, null=True, on_delete=models.SET_NULL, db_index=True) # if the survexfile object is deleted, then all the survex-blocks in it should be too, # though a block can span more than one file... survexfile = models.ForeignKey("SurvexFile", blank=True, null=True, on_delete=models.CASCADE, db_index=True) # survexpath = models.CharField(max_length=200, blank=True, null=True) No need for this anymore scanswallet = models.ForeignKey( - "Wallet", null=True, on_delete=models.SET_NULL + "Wallet", null=True, on_delete=models.SET_NULL, db_index=True ) # only ONE wallet per block. The most recent seen overwites.. ugh. legsall = models.IntegerField(null=True) # summary data for this block @@ -245,11 +245,11 @@ class SurvexPersonRole(models.Model): """The CASCADE means that if a SurvexBlock or a Person is deleted, then the SurvexPersonRole is deleted too """ - survexblock = models.ForeignKey("SurvexBlock", on_delete=models.CASCADE) + survexblock = models.ForeignKey("SurvexBlock", on_delete=models.CASCADE, db_index=True) # increasing levels of precision, Surely we only need survexblock and (either person or personexpedition)? personname = models.CharField(max_length=100) - person = models.ForeignKey("Person", blank=True, null=True, on_delete=models.CASCADE) # not needed - personexpedition = models.ForeignKey("PersonExpedition", blank=True, null=True, on_delete=models.SET_NULL) + person = models.ForeignKey("Person", blank=True, null=True, on_delete=models.CASCADE, db_index=True) # not needed + personexpedition = models.ForeignKey("PersonExpedition", blank=True, null=True, on_delete=models.SET_NULL, db_index=True) def __str__(self): return str(self.personname) + " - " + str(self.survexblock) |