diff options
author | Philip Sargent <philip.sargent@gmail.com> | 2025-01-10 00:28:01 +0000 |
---|---|---|
committer | Philip Sargent <philip.sargent@gmail.com> | 2025-01-10 00:28:01 +0000 |
commit | 49c0c0fe3ad054704329ad5204446056487e2424 (patch) | |
tree | cfae504f740e4cc02996189a5efaeadaa5e1f9e0 /core/models/logbooks.py | |
parent | 486a50f876354a8447886a33042f0f7517316078 (diff) | |
download | troggle-49c0c0fe3ad054704329ad5204446056487e2424.tar.gz troggle-49c0c0fe3ad054704329ad5204446056487e2424.tar.bz2 troggle-49c0c0fe3ad054704329ad5204446056487e2424.zip |
First attempts at better use of Django query optimisation
Diffstat (limited to 'core/models/logbooks.py')
-rw-r--r-- | core/models/logbooks.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/core/models/logbooks.py b/core/models/logbooks.py index 1c7c9f7..8c8edbc 100644 --- a/core/models/logbooks.py +++ b/core/models/logbooks.py @@ -25,9 +25,9 @@ class LogbookEntry(TroggleModel): date = ( models.DateField() ) - expedition = models.ForeignKey(Expedition, blank=True, null=True, on_delete=models.CASCADE) + expedition = models.ForeignKey(Expedition, blank=True, null=True, on_delete=models.CASCADE, db_index=True) title = models.CharField(max_length=200) - cave = models.ForeignKey("Cave", blank=True, null=True, on_delete=models.SET_NULL) + cave = models.ForeignKey("Cave", blank=True, null=True, on_delete=models.SET_NULL, db_index=True) place = models.CharField( max_length=100, blank=True, null=True, help_text="Only use this if you haven't chosen a cave" ) @@ -173,7 +173,7 @@ class PersonLogEntry(TroggleModel): then this PersonLogEntry is deleted too """ - personexpedition = models.ForeignKey("PersonExpedition", null=True, on_delete=models.CASCADE) + personexpedition = models.ForeignKey("PersonExpedition", null=True, on_delete=models.CASCADE, db_index=True) time_underground = models.FloatField(help_text="In decimal hours") logbook_entry = models.ForeignKey(LogbookEntry, on_delete=models.CASCADE, db_index=True) is_logbook_entry_author = models.BooleanField(default=False) |