From be0148d146263140961e3e47dccd54bc28827e0a Mon Sep 17 00:00:00 2001 From: Philip Sargent Date: Fri, 30 Apr 2021 21:32:53 +0100 Subject: [PATCH] removing cruft, renaming badly named things --- core/TESTS/test_imports.py | 2 +- core/TESTS/tests_logins.py | 4 +- core/templatetags/wiki_markup.py | 2 - core/views/caves.py | 2 +- core/views/logbooks.py | 4 +- core/views/other.py | 10 +- templates/base.html | 7 +- templates/cavebase.html | 6 +- templates/{editcave2.html => editcave.html} | 0 templates/editfile.html | 98 ------------------- templates/expowebbase.html | 41 -------- .../{personindex.html => notablepersons.html} | 0 templates/personForm.html | 6 -- templates/plainbase.html | 8 +- templates/qm.html | 1 - templates/subcave.html | 59 ----------- urls.py | 4 +- 17 files changed, 17 insertions(+), 237 deletions(-) rename templates/{editcave2.html => editcave.html} (100%) delete mode 100644 templates/editfile.html delete mode 100644 templates/expowebbase.html rename templates/{personindex.html => notablepersons.html} (100%) delete mode 100644 templates/personForm.html delete mode 100644 templates/subcave.html diff --git a/core/TESTS/test_imports.py b/core/TESTS/test_imports.py index 38d89ae..155851e 100644 --- a/core/TESTS/test_imports.py +++ b/core/TESTS/test_imports.py @@ -96,7 +96,7 @@ class SimpleTest(SimpleTestCase): from troggle.core.views.expo import expofiles_redirect, expofilessingle, expopage, editexpopage, mediapage, map, mapfile from troggle.core.views.logbooks import expedition, personexpedition, Expeditions_tsvListView, Expeditions_jsonListView from troggle.core.views.logbooks import get_logbook_entries, logbookentry, logbookSearch - from troggle.core.views.logbooks import personindex, person, get_people + from troggle.core.views.logbooks import notablepersons, person, get_people from troggle.core.views.other import troggle404, frontpage from troggle.core.views.prospect import prospecting from troggle.core.views.prospect import prospecting_image diff --git a/core/TESTS/tests_logins.py b/core/TESTS/tests_logins.py index 66e69c6..1637a2c 100644 --- a/core/TESTS/tests_logins.py +++ b/core/TESTS/tests_logins.py @@ -92,8 +92,8 @@ class PostTests(TestCase): content = response.content.decode() self.assertEqual(response.status_code, 200) self.assertEqual(response.status_code, HTTPStatus.OK) - with open('test_up.html', 'w') as f: - f.write(content) + # with open('test_up.html', 'w') as f: + # f.write(content) t = re.search(r'README.txt', content) self.assertIsNone(t, 'Logged in as \'' + u.username + '\' (not staff) but failed to upload file' ) diff --git a/core/templatetags/wiki_markup.py b/core/templatetags/wiki_markup.py index 966853d..7e9a4b1 100644 --- a/core/templatetags/wiki_markup.py +++ b/core/templatetags/wiki_markup.py @@ -169,8 +169,6 @@ def wiki_to_html_short(value, autoescape=None): value = re.sub(r"\[\[\s*cave:([^\s]+)\s*\s*\]\]", r'\1' % settings.URL_ROOT, value, re.DOTALL) #make people links value = re.sub(r"\[\[\s*person:(.+)\|(.+)\]\]",r'\2' % settings.URL_ROOT, value, re.DOTALL) - #make subcave links - value = re.sub(r"\[\[\s*subcave:(.+)\|(.+)\]\]",r'\2' % settings.URL_ROOT, value, re.DOTALL) #make cavedescription links value = re.sub(r"\[\[\s*cavedescription:(.+)\|(.+)\]\]",r'\2' % settings.URL_ROOT, value, re.DOTALL) diff --git a/core/views/caves.py b/core/views/caves.py index b7143cc..229aa57 100644 --- a/core/views/caves.py +++ b/core/views/caves.py @@ -354,7 +354,7 @@ def edit_cave(request, slug=None): #versionControlForm = VersionControlCommentForm() return render(request, - 'editcave2.html', + 'editcave.html', {'form': form, 'cave': cave, 'message': message, 'caveAndEntranceFormSet': ceFormSet, #'versionControlForm': versionControlForm diff --git a/core/views/logbooks.py b/core/views/logbooks.py index 3181a33..2ec6991 100644 --- a/core/views/logbooks.py +++ b/core/views/logbooks.py @@ -31,7 +31,7 @@ It uses the global object TROG to hold some cached pages. todo = '''Fix the get_person_chronology() display bug. ''' -def personindex(request): +def notablepersons(request): persons = Person.objects.all() # From what I can tell, "persons" seems to be the table rows, while "pcols" is the table columns. - AC 16 Feb 09 pcols = [ ] @@ -45,7 +45,7 @@ def personindex(request): if person.bisnotable(): notablepersons.append(person) - return render(request,'personindex.html', {'persons': persons, 'pcols':pcols, 'notablepersons':notablepersons}) + return render(request,'notablepersons.html', {'persons': persons, 'pcols':pcols, 'notablepersons':notablepersons}) def expedition(request, expeditionname): diff --git a/core/views/other.py b/core/views/other.py index c721a61..d3d1126 100644 --- a/core/views/other.py +++ b/core/views/other.py @@ -33,10 +33,6 @@ todo = ''' When we have done all the old logbooks, delete this function and the two templates. - But how does this interact with troggle/logbooksdump.py ? - -- deleted newfile() - check on deleted UploadFileForm using the editfile.html template which is about re-submitting - a LBE aka TripReport - ''' def todos(request, module): @@ -214,7 +210,7 @@ def scanupload(request, wallet=None): ''' filesaved = False actual_saved = [] - print(f'! - FORM scanupload - start {wallet}') + # print(f'! - FORM scanupload - start {wallet}') if wallet is None: wallet = "2021#01" # improve this later if not re.match('(19|20)\d\d:\d\d', wallet): @@ -248,12 +244,12 @@ def scanupload(request, wallet=None): if multiple: for f in multiple: actual_saved.append( fs.save(f.name, content=f) ) - print(f'! - FORM scanupload multiple {actual_saved}') + # print(f'! - FORM scanupload multiple {actual_saved}') filesaved = True files = [] dirs = [] - print(f'! - FORM scanupload - start {wallet} {dirpath}') + # print(f'! - FORM scanupload - start {wallet} {dirpath}') try: for f in dirpath.iterdir(): if f.is_dir(): diff --git a/templates/base.html b/templates/base.html index ccc6982..20d6af5 100644 --- a/templates/base.html +++ b/templates/base.html @@ -44,7 +44,7 @@ tasks to do | caves | expoers | - survey lengths | + survey lengths | statistics | Expo2018 | Expo2019 | @@ -65,10 +65,7 @@ {% block content %} diff --git a/templates/cavebase.html b/templates/cavebase.html index 81fc979..e68b99b 100644 --- a/templates/cavebase.html +++ b/templates/cavebase.html @@ -10,11 +10,7 @@ - + {% block extraheaders %}{% endblock %} diff --git a/templates/editcave2.html b/templates/editcave.html similarity index 100% rename from templates/editcave2.html rename to templates/editcave.html diff --git a/templates/editfile.html b/templates/editfile.html deleted file mode 100644 index b3b53ed..0000000 --- a/templates/editfile.html +++ /dev/null @@ -1,98 +0,0 @@ -{% extends "base.html" %} -{% load csrffaker %} -{% block title %}File{% endblock %} -{% block head %} - - - - - - -{{ fileForm.media }} -{% endblock %} -{% block content %} - -
{% csrf_token %} - {{ fileForm.non_field_errors }} -
- {{ fileForm.title.errors }} - - {{ fileForm.title }} -
-
- {{ fileForm.slug.errors }} - - {{ fileForm.slug }} -
-
- {{ fileForm.date.errors }} - - {{ fileForm.date }} -
-
- {{ fileForm.lon_utm.errors }} - - {{ fileForm.lon_utm }} -
-
- {{ fileForm.lat_utm.errors }} - - {{ fileForm.lat_utm }} -
-
- {{ fileForm.cave.errors }} - - {{ fileForm.cave }} -
-
- {{ fileForm.entrance.errors }} - - {{ fileForm.entrance }} -
-
- {{ fileForm.qm.errors }} - - {{ fileForm.qm }} -
-
- {{ fileForm.expedition.errors }} - - {{ fileForm.expedition }} -
-
- {{ fileForm.logbookentry.errors }} - - {{ fileForm.logbookentry }} -
-
- {{ fileForm.person.errors }} - - {{ fileForm.person }} -
-
- {{ fileForm.html.errors }} - - {{ fileForm.html }} -
-

-
- -{% endblock %} diff --git a/templates/expowebbase.html b/templates/expowebbase.html deleted file mode 100644 index 097c4e0..0000000 --- a/templates/expowebbase.html +++ /dev/null @@ -1,41 +0,0 @@ - - - - - -{% block title %}{% endblock %} - - - - - -{% block content %}{% endblock %} - - - diff --git a/templates/personindex.html b/templates/notablepersons.html similarity index 100% rename from templates/personindex.html rename to templates/notablepersons.html diff --git a/templates/personForm.html b/templates/personForm.html deleted file mode 100644 index 4577239..0000000 --- a/templates/personForm.html +++ /dev/null @@ -1,6 +0,0 @@ -{% extends "base.html" %} -{% block content %} - -{{ form }} - -{% endblock %} \ No newline at end of file diff --git a/templates/plainbase.html b/templates/plainbase.html index afeb8f9..5b209cf 100644 --- a/templates/plainbase.html +++ b/templates/plainbase.html @@ -1,4 +1,6 @@ {% autoescape off %} + + @@ -7,11 +9,7 @@ - + {% block extrahead %}{% endblock %} diff --git a/templates/qm.html b/templates/qm.html index 86ec2b5..58f040a 100644 --- a/templates/qm.html +++ b/templates/qm.html @@ -23,7 +23,6 @@

Related items

Parent cave: {{qm.found_by.cave|link}} -(to do: add parent survey and parent subcave) {% block content %}

Location

diff --git a/templates/subcave.html b/templates/subcave.html deleted file mode 100644 index 28023b1..0000000 --- a/templates/subcave.html +++ /dev/null @@ -1,59 +0,0 @@ -{% extends "cavebase.html" %} - -{% load mptt_tags %} -{% block title %} Subcave {{subcave}} {% endblock title %} -{% block editLink %}Edit subcave {{subcave|wiki_to_html_short}}{% endblock %} - -{% block contentheader %} - {{subcave.title}} -{% endblock contentheader %} - - - -{% block content %} -{% block related %} - -

Related places

- -

Parent

- - - -

Connected subareas

- - - -

Children

- - - - -{% endblock %} - -ok here comes the drilldown
-{% drilldown_tree_for_node subcave as drilldown %} -{% for each in drilldown %} -{{ each }}> -{% endfor %} - - -

{{subcave}}

-

- {{subcave.description}} -

- -{% endblock content %} \ No newline at end of file diff --git a/urls.py b/urls.py index 85a9759..3ca192d 100644 --- a/urls.py +++ b/urls.py @@ -14,7 +14,7 @@ from troggle.core.views.other import troggle404, frontpage, todos, controlpanel, from troggle.core.views.other import exportlogbook from troggle.core.views.caves import ent, cavepage from troggle.core.views.logbooks import get_logbook_entries, logbookentry, logbookSearch -from troggle.core.views.logbooks import personindex, person, get_people +from troggle.core.views.logbooks import notablepersons, person, get_people from troggle.core.views.logbooks import expedition, personexpedition, Expeditions_tsvListView, Expeditions_jsonListView from troggle.core.views.prospect import prospecting_image from troggle.core.views.prospect import prospecting @@ -73,7 +73,7 @@ trogglepatterns = [ re_path(r'^caves$', caves.caveindex, name="caveindex"), re_path(r'^indxal.htm$', caves.caveindex, name="caveindex"), # ~420 hrefs to this url in expoweb files - re_path(r'^people/?$', personindex, name="personindex"), + re_path(r'^people/?$', notablepersons, name="notablepersons"), re_path(r'^admin/doc/', include('django.contrib.admindocs.urls')), # needs docutils Python module (http://docutils.sf.net/). re_path(r'^admin/', admin.site.urls), # includes admin login & logout urls