2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-25 08:41:51 +00:00

lat/long values now persistent on Entrances

This commit is contained in:
Philip Sargent 2023-09-27 00:38:07 +03:00
parent 9aad95bfd0
commit 0d5297f08c
3 changed files with 11 additions and 4 deletions

View File

@ -235,7 +235,6 @@ class Entrance(TroggleModel):
bearings = models.TextField(blank=True, null=True)
easting = models.TextField(blank=True, null=True) # apparently? manually entered not calculated
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)
@ -250,13 +249,15 @@ class Entrance(TroggleModel):
name = models.CharField(max_length=100, blank=True, null=True)
northing = models.TextField(blank=True, null=True) # apparently? manually entered not calculated
other_description = models.TextField(blank=True, null=True)
other_station = models.TextField(blank=True, null=True)
photo = models.TextField(blank=True, null=True)
slug = models.SlugField(max_length=50, unique=True, default="default_slug_id")
tag_station = models.TextField(blank=True, null=True)
underground_description = models.TextField(blank=True, null=True)
url = models.CharField(max_length=300, 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)
class Meta:
ordering = ["caveandentrance__entranceletter"]
@ -412,7 +413,7 @@ class Entrance(TroggleModel):
def latlong(self):
"""Gets lat long assuming that it has to get it from the associated stations, but in fact the Entrance itself
has easting/northing and lat/long fields which perhaps we should try first...
has easting/northing and lat/long fields which perhaps we should try first... or last ?!
"""
if self.easting and self.northing:
return utmToLatLng(33, float(self.easting), float(self.northing), northernHemisphere=True)

View File

@ -474,6 +474,8 @@ def read_entrance(filename, ent=None):
print(message)
lastvisit = getXML(entrancecontents, "lastvisit", maxItems=1, minItems=0, context=f"/cave/{slug}/edit/")
lat_wgs84 = getXML(entrancecontents, "lat_wgs84", maxItems=1, minItems=0, context=f"/cave/{slug}/edit/")
long_wgs84 = getXML(entrancecontents, "long_wgs84", maxItems=1, minItems=0, context=f"/cave/{slug}/edit/")
alt = getXMLmax1("alt")
approach = getXMLmax1("approach")
@ -507,6 +509,8 @@ def read_entrance(filename, ent=None):
ent.approach=approach[0]
ent.bearings=bearings[0]
ent.easting=easting[0]
ent.lat_wgs84=lat_wgs84[0]
ent.long_wgs84=long_wgs84[0]
ent.entrance_description=entrance_description[0]
ent.exact_station=exact_station[0]
ent.explorers=explorers[0]

View File

@ -49,6 +49,8 @@ though, you do not need to do a data import as it happens automatically -->
<alt>{{ entrance.alt|default_if_none:""|safe }}</alt>
<northing>{{ entrance.northing|default_if_none:""|safe }}</northing>
<easting>{{ entrance.easting|default_if_none:""|safe }}</easting>
<lat_wgs84>{{ entrance.lat_wgs84|default_if_none:""|safe }}</lat_wgs84>
<long_wgs84>{{ entrance.long_wgs84|default_if_none:""|safe }}</long_wgs84>
<tag_station>{{ entrance.tag_station|default_if_none:""|safe }}</tag_station>
<exact_station>{{ entrance.exact_station|default_if_none:""|safe }}</exact_station>
<other_station>{{ entrance.other_station|default_if_none:""|safe }}</other_station>