summaryrefslogtreecommitdiffstats
path: root/core/models/caves.py
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-03-28 15:37:25 +0100
committerPhilip Sargent <philip.sargent@gmail.com>2023-03-28 15:37:25 +0100
commit6ca5d5bfa83ef59a6ecc93a6ef9b12abf137be38 (patch)
treeb50de0eff0ac41778a09e55584900194973b219d /core/models/caves.py
parent2091eb8e8bbeddb8b7ca57f4bd0032ece60618e6 (diff)
downloadtroggle-6ca5d5bfa83ef59a6ecc93a6ef9b12abf137be38.tar.gz
troggle-6ca5d5bfa83ef59a6ecc93a6ef9b12abf137be38.tar.bz2
troggle-6ca5d5bfa83ef59a6ecc93a6ef9b12abf137be38.zip
debug ent report
Diffstat (limited to 'core/models/caves.py')
-rw-r--r--core/models/caves.py75
1 files changed, 40 insertions, 35 deletions
diff --git a/core/models/caves.py b/core/models/caves.py
index 0001814..bae8eb5 100644
--- a/core/models/caves.py
+++ b/core/models/caves.py
@@ -74,30 +74,32 @@ class CaveAndEntrance(models.Model):
def __str__(self):
return str(self.cave) + str(self.entrance_letter)
+# class CaveSlug(models.Model):
+# moved to models/logbooks.py to avoid cyclic import problem
class Cave(TroggleModel):
# too much here perhaps,
- official_name = models.CharField(max_length=160)
area = models.ManyToManyField(Area, blank=True)
- kataster_code = models.CharField(max_length=20, blank=True, null=True)
- kataster_number = models.CharField(max_length=10, blank=True, null=True)
- unofficial_number = models.CharField(max_length=60, blank=True, null=True)
+ depth = models.CharField(max_length=100, blank=True, null=True)
+ description_file = models.CharField(max_length=200, blank=True, null=True)
entrances = models.ManyToManyField("Entrance", through="CaveAndEntrance")
- explorers = models.TextField(blank=True, null=True)
- underground_description = models.TextField(blank=True, null=True)
equipment = models.TextField(blank=True, null=True)
- references = models.TextField(blank=True, null=True)
- survey = models.TextField(blank=True, null=True)
+ explorers = models.TextField(blank=True, null=True)
+ extent = models.CharField(max_length=100, blank=True, null=True)
+ filename = models.CharField(max_length=200)
+ kataster_code = models.CharField(max_length=20, blank=True, null=True)
+ kataster_number = models.CharField(max_length=10, blank=True, null=True)
kataster_status = models.TextField(blank=True, null=True)
- underground_centre_line = models.TextField(blank=True, null=True)
- notes = models.TextField(blank=True, null=True)
length = models.CharField(max_length=100, blank=True, null=True)
- depth = models.CharField(max_length=100, blank=True, null=True)
- extent = models.CharField(max_length=100, blank=True, null=True)
+ notes = models.TextField(blank=True, null=True)
+ official_name = models.CharField(max_length=160)
+ references = models.TextField(blank=True, null=True)
survex_file = models.CharField(max_length=100, blank=True, null=True) # should be a foreign key
- description_file = models.CharField(max_length=200, blank=True, null=True)
+ survey = models.TextField(blank=True, null=True)
+ underground_centre_line = models.TextField(blank=True, null=True)
+ underground_description = models.TextField(blank=True, null=True)
+ unofficial_number = models.CharField(max_length=60, blank=True, null=True)
url = models.CharField(max_length=200, blank=True, null=True)
- filename = models.CharField(max_length=200)
# class Meta:
# unique_together = (("area", "kataster_number"), ("area", "unofficial_number"))
@@ -267,15 +269,6 @@ class EntranceSlug(models.Model):
class Entrance(TroggleModel):
- name = models.CharField(max_length=100, blank=True, null=True)
- entrance_description = models.TextField(blank=True, null=True)
- explorers = models.TextField(blank=True, null=True)
- map_description = models.TextField(blank=True, null=True)
- location_description = models.TextField(blank=True, null=True)
- lastvisit = models.TextField(blank=True, null=True)
- approach = models.TextField(blank=True, null=True)
- underground_description = models.TextField(blank=True, null=True)
- photo = models.TextField(blank=True, null=True)
MARKING_CHOICES = (
("P", "Paint"),
("P?", "Paint (?)"),
@@ -286,25 +279,34 @@ class Entrance(TroggleModel):
("S?", "Spit (?)"),
("U", "Unmarked"),
("?", "Unknown"),
- )
- marking = models.CharField(max_length=2, choices=MARKING_CHOICES)
- marking_comment = models.TextField(blank=True, null=True)
+ )
FINDABLE_CHOICES = (("?", "To be confirmed ..."), ("S", "Coordinates"), ("L", "Lost"), ("R", "Refindable"))
- findability = models.CharField(max_length=1, choices=FINDABLE_CHOICES, blank=True, null=True)
- findability_description = models.TextField(blank=True, null=True)
alt = models.TextField(blank=True, null=True)
- northing = models.TextField(blank=True, null=True)
+ approach = models.TextField(blank=True, null=True)
+ bearings = models.TextField(blank=True, null=True)
+ cached_primary_slug = models.CharField(max_length=200, blank=True, null=True)
easting = models.TextField(blank=True, null=True)
+ entrance_description = models.TextField(blank=True, null=True)
+ exact_station = models.TextField(blank=True, null=True)
+ explorers = models.TextField(blank=True, null=True)
+ filename = models.CharField(max_length=200)
+ findability = models.CharField(max_length=1, choices=FINDABLE_CHOICES, blank=True, null=True)
+ findability_description = models.TextField(blank=True, null=True)
+ lastvisit = models.TextField(blank=True, null=True)
lat_wgs84 = models.TextField(blank=True, null=True)
+ location_description = models.TextField(blank=True, null=True)
long_wgs84 = models.TextField(blank=True, null=True)
- tag_station = models.TextField(blank=True, null=True)
- exact_station = models.TextField(blank=True, null=True)
- other_station = models.TextField(blank=True, null=True)
+ map_description = models.TextField(blank=True, null=True)
+ marking = models.CharField(max_length=2, choices=MARKING_CHOICES)
+ marking_comment = models.TextField(blank=True, null=True)
+ name = models.CharField(max_length=100, blank=True, null=True)
+ northing = models.TextField(blank=True, null=True)
other_description = models.TextField(blank=True, null=True)
- bearings = models.TextField(blank=True, null=True)
+ other_station = models.TextField(blank=True, null=True)
+ photo = models.TextField(blank=True, null=True)
+ tag_station = models.TextField(blank=True, null=True)
+ underground_description = models.TextField(blank=True, null=True)
url = models.CharField(max_length=200, blank=True, null=True)
- filename = models.CharField(max_length=200)
- cached_primary_slug = models.CharField(max_length=200, blank=True, null=True)
class Meta:
ordering = ["caveandentrance__entrance_letter"]
@@ -393,6 +395,9 @@ class Entrance(TroggleModel):
return res
def slug(self):
+ """Returns the first slug with primary=True that it can find,
+ if there are none with primary=True, then it returns the first slug it finds
+ """
if not self.cached_primary_slug:
primarySlugs = self.entranceslug_set.filter(primary=True)
if primarySlugs: