summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Containerfile46
-rw-r--r--core/forms.py25
-rw-r--r--core/views/caves.py8
-rw-r--r--templates/cave.html9
-rw-r--r--templates/editentrance.html2
5 files changed, 73 insertions, 17 deletions
diff --git a/Containerfile b/Containerfile
new file mode 100644
index 0000000..acefff1
--- /dev/null
+++ b/Containerfile
@@ -0,0 +1,46 @@
+# Containerfile originally created by MS Copilot 1st July 2025
+# hand edited Philip Sargent
+
+# move this to the directory above troggle, loser etc before running it.
+
+#
+FROM ghcr.io/astral-sh/uv:python3.13-bookworm
+WORKDIR /EXPO
+
+USER root
+RUN apt update && \
+ apt-get install sqlite3 survex rsync -y && \
+ useradd -m expopod -G sudo -s /bin/bash
+
+
+# Copy only the dependency files first
+COPY troggle/pyproject.toml troggle/uv.lock ./troggle/
+
+COPY expofiles/surveyscans/2018 /EXPO/expofiles/surveyscans/2018
+COPY expofiles/photos/2018/PhilipSargent/ /EXPO/expofiles/photos/2018/PhilipSargent
+COPY troggle /EXPO/troggle
+COPY expoweb /EXPO/expoweb
+COPY loser /EXPO/loser
+COPY drawings /EXPO/drawings
+RUN chown -R expopod:expopod .
+USER expopod
+
+# Install dependencies and Django
+RUN cd troggle && uv sync --frozen
+
+RUN git config --global user.email "expopod@potato.hut"
+RUN git config --global user.name "expopod"
+RUN git config --global pull.rebase true
+
+RUN cd troggle && uv run databaseReset.py reset INIT
+
+EXPOSE 8080
+CMD ["uv", "run", "python", "troggle/manage.py", "runserver", "0.0.0.0:8080"]
+CMD ["bash"]
+
+# move this file to the directory above troggle, loser etc before running the podman image build command.
+
+# if this was used like this:
+# podman image build . --tag expo-01
+# run this image interactively with
+# podman run -it --network=host --rm expo-01 \ No newline at end of file
diff --git a/core/forms.py b/core/forms.py
index b9a8c1f..ccdd307 100644
--- a/core/forms.py
+++ b/core/forms.py
@@ -103,7 +103,7 @@ class CaveForm(ModelForm):
length = forms.CharField(required=False, label="Length (m)", widget=forms.TextInput(attrs={"placeholder": "usually blank"}))
depth = forms.CharField(required=False, label="Depth (m)", widget=forms.TextInput(attrs={"placeholder": "usually blank"}))
extent = forms.CharField(required=False, label="Extent (m)", widget=forms.TextInput(attrs={"placeholder": "usually blank"}))
- areacode = forms.CharField(required=False, label="Area code", widget=forms.TextInput(attrs={"placeholder": "e.g. 1623"}))
+ areacode = forms.CharField(required=False, label="Area code", widget=forms.TextInput(attrs={"placeholder": "e.g. 1623"})) # should be required=True?
subarea = forms.CharField(required=False, label="Subarea (do not use for new caves)", widget=forms.TextInput(attrs={"placeholder": "usually blank, archaic"}))
#cave_slug = forms.CharField()
@@ -143,16 +143,11 @@ class CaveForm(ModelForm):
self._errors["unofficial_number"] = self.error_class(
["Either the kataster or unoffical number is required."]
)
- # if self.cleaned_data.get("kataster_number") != "" and self.cleaned_data.get("official_name") == "":
- # self._errors["official_name"] = self.error_class(["This field is required when there is a kataster number."])
- # if cleaned_data.get("url") == []:
- # self._errors["url"] = self.error_class(["This field is required."])
- # if cleaned_data.get("url") and cleaned_data.get("url").startswith("/"):
- # self._errors["url"] = self.error_class(["This field cannot start with a /."])
- if self.data.get("areacode") == "":
+ if self.data.get("areacode") not in ["1623", "1626", "1627", "1624"]:
self._errors["areacode"] = self.error_class(
- ["An areacode, e.g. 1623, is required."]
+ ["An Austrian kataster areacode, i.e. 1623, 1626, 1627, or 1624 is required."]
)
+
return cleaned_data
@@ -261,10 +256,14 @@ class EntranceForm(ModelForm):
)
def clean(self):
- # if self.cleaned_data.get("url"): # can remove this as the form does not have a url field any more, which was never used anyway
- # if self.cleaned_data.get("url").startswith("/"):
- # self._errors["url"] = self.error_class(["This field cannot start with a /."])
- return self.cleaned_data
+ cleaned_data = super(EntranceForm, self).clean() # where is this code hidden? How does this work??
+ for station in ["tag_station", "other_station"]:
+ print(f"{station} -- {self.data.get(station)[:4]}")
+ if self.data.get(station)[:5] not in ["1623.", "1626.", "1627.", "1624.", ""]:
+ self._errors[station] = self.error_class(
+ ["An Austrian kataster areacode, i.e. 1623, 1626, 1627, or 1624 prefix is required."]
+ )
+ return self.cleaned_data
# # This next line is sufficient to create an entire entry for for the cave fields automatically
diff --git a/core/views/caves.py b/core/views/caves.py
index 856c2cd..2498fb4 100644
--- a/core/views/caves.py
+++ b/core/views/caves.py
@@ -657,6 +657,8 @@ def edit_entrance(request, path="", caveslug=None, entslug=None):
nextletter = chr(ord(letter)+1)
return check_new_slugname_ok(slug, nextletter)
+ entletter = "" # default to stop crashes
+ entletterform = None
if not (cave:= get_cave_from_slug(caveslug)): # walrus operator
return render(request, "errors/badslug.html", {"badslug": f"for cave {caveslug} - from edit_entrance()"})
@@ -720,10 +722,10 @@ def edit_entrance(request, path="", caveslug=None, entslug=None):
entranceletter=""
if not entform.is_valid():
- message = f"- POST INVALID {caveslug=} {entslug=} {path=} entform valid:{entform.is_valid()} entletterform valid:{entletterform.is_valid()}"
- entrance = entform.save(commit=False)
+ message = f"- POST INVALID {caveslug=} {entslug=} {path=} entform valid:{entform.is_valid()} "
+ # entrance = entform.save(commit=False)
print(message)
- return render(request, "errors/generic.html", {"message": message})
+ # return render(request, "errors/generic.html", {"message": message})
else:
print(f"'edit_entrance(): POST is valid {caveslug=} Editing {entslug=} {entranceletter=} {path=}")
diff --git a/templates/cave.html b/templates/cave.html
index dd1155a..c7aa579 100644
--- a/templates/cave.html
+++ b/templates/cave.html
@@ -188,6 +188,15 @@ Nope, it is not useful, removing it... Philip S.
{% if ent.entrance.lat_wgs84 %}
<dt>Location</dt><dd><a href="https://www.openstreetmap.org/?mlat={{ ent.entrance.lat_wgs84|floatformat:7}}&mlon={{ent.entrance.long_wgs84|floatformat:7}}">WGS84 Lat.: {{ ent.entrance.lat_wgs84|floatformat:7 }} N, Long.:{{ ent.entrance.long_wgs84|floatformat:7 }} E</a></dd>
+<p>This would be eventually replaced with something like this in the appropriate gps file in the <var>fixedpts/gps/</var> folder
+for the kataster area <var>{{cave.areacode}}</var> :
+<pre><code>*begin
+*cs out UTM33
+*cs LONG-LAT
+*fix p{{ ent.entrance.name|lower|safe }} {{ent.entrance.long_wgs84|floatformat:7}} {{ ent.entrance.lat_wgs84|floatformat:7 }} {% if ent.entrance.alt %}{{ ent.entrance.alt|safe }}{% else%}0.0{% endif %}
+*end</code></pre>
+and the appropriate <var>*equate</var> and <var>*entrance</var> fields in the survex file <var>{{cave.survex_file|safe}}</var>
+to equate <var>p{{ ent.entrance.name|lower|safe }}</var> to the actual survey station. The WGS84 fields on the entrance edit form would be deleted, and a Tag/Other survex station id to <var>{{cave.areacode}}.p{{ ent.entrance.name|lower|safe }} </var>used instead.
{% endif %}
{% if ent.entrance.tag_station %}
<dt>Tag Location</dt><dd>{{ ent.entrance.tag_station }} <a href="https://www.openstreetmap.org/?mlat={{ ent.entrance.tag.latlong.0}}&mlon={{ent.entrance.tag.latlong.1}}">{{ ent.entrance.tag.latlong.0|floatformat:5 }}N {{ ent.entrance.tag.latlong.1|floatformat:5 }}E</a> (UTM33 {{ ent.entrance.tag.x|floatformat:0 }}, {{ ent.entrance.tag.y|floatformat:0 }}), {{ ent.entrance.tag.z|floatformat:0 }}m (SRTM is {{ ent.entrance.tag.srtm_diff.0|safe }} m, distance from reference: {{ent.entrance.tag.srtm_alt.1|floatformat:0}}m)
diff --git a/templates/editentrance.html b/templates/editentrance.html
index d9957a0..f43bb23 100644
--- a/templates/editentrance.html
+++ b/templates/editentrance.html
@@ -9,7 +9,7 @@
{% include 'html_editor_pop_ups.html' %}
<!-- If you are looking for the furniture that creates the fields on this form, you need to look
-at troggle/core/forms.py ass this uses a Django magic form creation thinggy. -->
+at troggle/core/forms.py as this uses a Django magic form creation thinggy. -->
<h2>{{message}}</h2>
<form action="" method="post">{% csrf_token %}