=Added string to caveslugs so admin interface works. Added explanation for the rational for cave slugs.

This commit is contained in:
Expo on server 2023-07-08 23:45:32 +01:00
parent beab42323b
commit 086537cb56

View File

@ -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