summaryrefslogtreecommitdiffstats
path: root/core/views
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2023-11-02 21:05:08 +0200
committerPhilip Sargent <philip.sargent@gmail.com>2023-11-02 21:05:08 +0200
commitc7cb8ece2eb8f7c711f5fce4c2f53b319011955d (patch)
tree87ae07817c6192f6203b92cb9a3a89b51954e757 /core/views
parent685131a4c16578d6370cdd8db37f8b0cc4d7fa1f (diff)
downloadtroggle-c7cb8ece2eb8f7c711f5fce4c2f53b319011955d.tar.gz
troggle-c7cb8ece2eb8f7c711f5fce4c2f53b319011955d.tar.bz2
troggle-c7cb8ece2eb8f7c711f5fce4c2f53b319011955d.zip
comments trying to understand..
Diffstat (limited to 'core/views')
-rw-r--r--core/views/editor_helpers.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/core/views/editor_helpers.py b/core/views/editor_helpers.py
index 91ba01e..0c3f5b6 100644
--- a/core/views/editor_helpers.py
+++ b/core/views/editor_helpers.py
@@ -22,9 +22,15 @@ MAX_IMAGE_HEIGHT = 800
THUMBNAIL_WIDTH = 200
THUMBNAIL_HEIGHT = 200
+"""This is all written by Martin Green, and completely undocumented.
+
+It uses a lot of opinionated Django default magic, none of which I am familiar with.
+Philip
+"""
def get_dir(path):
"From a path sent from urls.py, determine the directory."
+ # todo re-write this to use modern pathlib functions
if "/" in path:
return path.rsplit("/", 1)[0]
else:
@@ -34,6 +40,7 @@ def get_dir(path):
def image_selector(request, path):
"""Returns available images"""
directory = get_dir(path)
+ print(f" - image selector {directory=} {path=}")
thumbnailspath = Path(settings.EXPOWEB) / directory / "t"
thumbnails = []
if thumbnailspath.is_dir():
@@ -116,7 +123,7 @@ def new_image_form(request, path):
thumbnail = thumbnail.convert('RGB')
thumbnail.save(tb, format="jpeg", quality = 70)
image_rel_path, thumb_rel_path, desc_rel_path = form.get_rel_paths()
- image_page_template = loader.get_template("image_page_template.html")
+ image_page_template = loader.get_template("image_page_template.html") # this is the .html file in the /l/ folder
image_page = image_page_template.render(
{
"header": form.cleaned_data["header"],
@@ -190,7 +197,7 @@ class NewWebImageForm(forms.Form):
]
def get_full_paths(self):
- return [Path(settings.EXPOWEB) / x for x in self.get_rel_paths()]
+ return [Path(settings.EXPOWEB) / x for x in self.get_rel_paths()] # this is where we would want to insert the /caveid/ ?!
def clean_file_(self):
for rel_path, full_path in zip(self.get_rel_paths(), self.get_full_paths()):
@@ -200,6 +207,9 @@ class NewWebImageForm(forms.Form):
class HTMLarea(forms.Textarea):
+ """This is called from CaveForm in core/forms.py which is called from core/views/caves.py when editing a cave description
+ (and similarly for Entrance Descriptions). It is alls called from core/views/expo.py when editing expo (i.e. handbook) pages.
+ """
template_name = "widgets/HTMLarea.html"
def __init__(self, *args, **kwargs):