diff options
author | Martin Green <martin.speleo@gmail.com> | 2023-07-10 17:00:56 +0200 |
---|---|---|
committer | Martin Green <martin.speleo@gmail.com> | 2023-07-10 17:00:56 +0200 |
commit | 67361fa66c1aa2885ba90b68b9d9181f7a5b981b (patch) | |
tree | 256d4bcc22760cc396a09782df3760e345dc00da /core/models/logbooks.py | |
parent | b27852c1f3fd3280e36ca0973b34a64c361b536a (diff) | |
parent | 8ff438942dd0981d2dd442dae3e61fbd5a84280e (diff) | |
download | troggle-67361fa66c1aa2885ba90b68b9d9181f7a5b981b.tar.gz troggle-67361fa66c1aa2885ba90b68b9d9181f7a5b981b.tar.bz2 troggle-67361fa66c1aa2885ba90b68b9d9181f7a5b981b.zip |
Merge branch 'master' of ssh://expo.survex.com/home/expo/troggle
Diffstat (limited to 'core/models/logbooks.py')
-rw-r--r-- | core/models/logbooks.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/core/models/logbooks.py b/core/models/logbooks.py index 9a13b59..b0bde61 100644 --- a/core/models/logbooks.py +++ b/core/models/logbooks.py @@ -11,8 +11,15 @@ from troggle.core.models.troggle import Expedition, TroggleModel """ todo = """ -- Can we rewrite things to eliminate the CaveSlug and objects? Surely - foreign keys work fine ?! +- Can we rewrite things to eliminate the CaveSlug and objects? No + Surely foreign keys work fine ?! No + + Foreign keys do not allow for there being multiple ways to refer to a cave, eg 1623-1999-03 aka 1623-204 + Having slugs allows for much more loose coupling to caves, which removes alot of the need to reset the database, which interupts work flow. + It also means we do not have to be creating temporary cave objects in the database, where we do not have the underlying file in cave_data. + + To Do move Cave Slug back to troggle.core.models + """ @@ -25,6 +32,9 @@ class CaveSlug(models.Model): slug = models.SlugField(max_length=50, unique=True) primary = models.BooleanField(default=False) + def __str__(self): + return f"{self.slug}: {self.cave}" + class LogbookEntry(TroggleModel): """Single parsed entry from Logbook |