2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

removing cruft, renaming badly named things

This commit is contained in:
Philip Sargent 2021-04-30 21:32:53 +01:00
parent 8f1d6e2cc2
commit be0148d146
17 changed files with 17 additions and 237 deletions

View File

@ -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

View File

@ -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' )

View File

@ -169,8 +169,6 @@ def wiki_to_html_short(value, autoescape=None):
value = re.sub(r"\[\[\s*cave:([^\s]+)\s*\s*\]\]", r'<a href="%scave/\1/">\1</a>' % settings.URL_ROOT, value, re.DOTALL)
#make people links
value = re.sub(r"\[\[\s*person:(.+)\|(.+)\]\]",r'<a href="%sperson/\1/">\2</a>' % settings.URL_ROOT, value, re.DOTALL)
#make subcave links
value = re.sub(r"\[\[\s*subcave:(.+)\|(.+)\]\]",r'<a href="%ssubcave/\1/">\2</a>' % settings.URL_ROOT, value, re.DOTALL)
#make cavedescription links
value = re.sub(r"\[\[\s*cavedescription:(.+)\|(.+)\]\]",r'<a href="%scavedescription/\1/">\2</a>' % settings.URL_ROOT, value, re.DOTALL)

View File

@ -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

View File

@ -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):

View File

@ -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():

View File

@ -44,7 +44,7 @@
<a href="/handbook/computing/todo-data.html">tasks to do </a> |
<a id="cavesLink" href="{% url "caveindex" %}">caves</a> |
<a id="folklink" href="/folk">expoers</a> |
<a id="caversLink" href="{% url "personindex" %}">survey lengths</a> |
<a id="caversLink" href="{% url "notablepersons" %}">survey lengths</a> |
<a href="{% url "stats" %}">statistics</a> |
<a href="{% url "expedition" 2018 %}">Expo2018</a> |
<a href="{% url "expedition" 2019 %}">Expo2019</a> |
@ -65,10 +65,7 @@
<div id="related">
{% block related %}
<script language="javascript">
$('#related').remove()
/*This is a hack to stop a line appearing because of the empty div border*/
</script>
{% endblock %}
</div>
{% block content %}

View File

@ -10,11 +10,7 @@
<link rel="stylesheet" type="text/css" href="{{ settings.JSLIB_URL }}jquery-ui/css/smoothness/jquery-ui.css" />
<script src="{{ settings.JSLIB_URL }}jquery/jquery.min.js" type="text/javascript"></script>
<script src="{{ settings.JSLIB_URL }}jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$( "#tabs" ).tabs();
});
</script>
{% block extraheaders %}{% endblock %}
</head>
<body>

View File

@ -1,98 +0,0 @@
{% extends "base.html" %}
{% load csrffaker %}
{% block title %}File{% endblock %}
{% block head %}
<script>
$(function() {
$("#id_date").datepicker({dateFormat: "yy-mm-dd"});
$("#id_cave").change(function() {
$('#id_entrance').load('{% url "get_entrances" caveslug="" %}' + this.value);
});
$("#id_cave").change(function() {
$('#id_qm').load('{% url "get_qms" caveslug="" %}' + this.value);
});
$("#id_expedition").change(function() {
$('#id_logbookentry').load('{% url "get_logbook_entries" expeditionslug="" %}' + this.value);
});
$("#id_expedition").change(function() {
$('#id_person').load('{% url "get_people" expeditionslug="" %}' + this.value);
});
});
</script>
<link rel="stylesheet" href="{{ settings.JSLIB_URL }}jquery-ui/css/lightness/jquery-ui.css" type="text/css" media="all" />
<script src="{{ settings.JSLIB_URL }}jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script src="{{ settings.MEDIA_URL }}js/jquery.formset.min.js" type="text/javascript"></script>
<!--<script src="{{ settings.TINY_MCE_MEDIA_URL }}tiny_mce.js" type="text/javascript"></script>
-->
{{ fileForm.media }}
{% endblock %}
{% block content %}
<form action="" method="post">{% csrf_token %}
{{ fileForm.non_field_errors }}
<div class="fieldWrapper">
{{ fileForm.title.errors }}
<label for="id_title">Title:</label>
{{ fileForm.title }}
</div>
<div class="fieldWrapper">
{{ fileForm.slug.errors }}
<label for="id_slug">Slug:</label>
{{ fileForm.slug }}
</div>
<div class="fieldWrapper">
{{ fileForm.date.errors }}
<label for="id_date">Date:</label>
{{ fileForm.date }}
</div>
<div class="fieldWrapper" id="lon_utm">
{{ fileForm.lon_utm.errors }}
<label for="id_lon_utm">Longitude:</label>
{{ fileForm.lon_utm }}
</div>
<div class="fieldWrapper" id="lat_utm">
{{ fileForm.lat_utm.errors }}
<label for="id_lat_utm">Latitude:</label>
{{ fileForm.lat_utm }}
</div>
<div class="fieldWrapper" id="cave">
{{ fileForm.cave.errors }}
<label for="id_cave">Cave:</label>
{{ fileForm.cave }}
</div>
<div class="fieldWrapper" id="entrance">
{{ fileForm.entrance.errors }}
<label for="id_entrance">Entrance:</label>
{{ fileForm.entrance }}
</div>
<div class="fieldWrapper" id="qm">
{{ fileForm.qm.errors }}
<label for="id_cavem">QM:</label>
{{ fileForm.qm }}
</div>
<div class="fieldWrapper" id="expedition">
{{ fileForm.expedition.errors }}
<label for="id_expediton">Expedition:</label>
{{ fileForm.expedition }}
</div>
<div class="fieldWrapper" id="logbookentry">
{{ fileForm.logbookentry.errors }}
<label for="id_logbookentry">Logbook Entry:</label>
{{ fileForm.logbookentry }}
</div>
<div class="fieldWrapper" id="person">
{{ fileForm.person.errors }}
<label for="id_expediton">Person:</label>
{{ fileForm.person }}
</div>
<div class="fieldWrapper">
{{ fileForm.html.errors }}
<label for="id_date">Content:</label>
{{ fileForm.html }}
</div>
<p><input type="submit" value="Submit Trip Report" /></p>
</form>
{% endblock %}

View File

@ -1,41 +0,0 @@
<!DOCTYPE html>
<!-- expowebbase.html - this text visible because this template has been included -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{% block title %}{% endblock %}
</title>
<link rel="stylesheet" type="text/css" href="../css/main2.css" />
</head>
<body>
<div id="mainmenu">
<ul>
<li><a href="/index.htm">Expo website home</a></li>
<li><a href="/intro.html">Introduction</a></li>
<li><a href="/infodx.htm">Main index</a></li>
<li><a href="/caves">Cave index</a></li>
{% if cavepage %}
<ul>
<li><a href="{% url "survexcaveslist" %}">All Survex</a></li>
<li><a href="{% url "allwallets" %}">Scans</a></li>
<li><a href="{% url "dwgdata" %}">Drawings</a></li>
<li><a href="{% url "survexcavessingle" "caves-1623/290/290.svx" %}">290</a></li>
<li><a href="{% url "survexcavessingle" "caves-1623/291/291.svx" %}">291</a></li>
<li><a href="{% url "survexcavessingle" "caves-1626/359/359.svx" %}">359</a></li>
<li><a href="{% url "survexcavessingle" "caves-1623/258/258.svx" %}">258</a></li>
<li><a href="{% url "survexcavessingle" "caves-1623/264/264.svx" %}">264</a></li>
<li><a href="{% url "expedition" 2018 %}">Expo2018</a></li>
<li><a href="{% url "expedition" 2019 %}">Expo2019</a></li>
<li><a href="/admin">Django admin</a></li>
</ul>
{% endif %}
<li><a href="/handbook/index.htm">Expedition handbook</a></li>
<li><a href="/pubs.htm">Published reports</a></li>
<li><a href="/areas.htm">Area description</a></li>
<li><a href="/">CUCC website</a></li>
</ul>
</div>
{% block content %}{% endblock %}
</body>
</html>

View File

@ -1,6 +0,0 @@
{% extends "base.html" %}
{% block content %}
{{ form }}
{% endblock %}

View File

@ -1,4 +1,6 @@
{% autoescape off %}
<!-- svxfile.html - this text visible because this template has been included -->
<!-- This is ONLY used by templates/prospecting.html -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
@ -7,11 +9,7 @@
<link rel="stylesheet" type="text/css" href="{{ settings.JSLIB_URL }}jquery-ui/css/smoothness/jquery-ui.css" />
<script src="{{ settings.JSLIB_URL }}jquery/jquery.min.js" type="text/javascript"></script>
<script src="{{ settings.JSLIB_URL }}jquery-ui/jquery-ui.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$( "#tabs" ).tabs();
});
</script>
{% block extrahead %}{% endblock %}
</head>
<body {% block bodyattrs %}{% endblock %}>

View File

@ -23,7 +23,6 @@
<h2>Related items</h2>
Parent cave: {{qm.found_by.cave|link}}
(to do: add parent survey and parent subcave)
{% block content %}
<h3>Location</h3>

View File

@ -1,59 +0,0 @@
{% extends "cavebase.html" %}
{% load mptt_tags %}
{% block title %} Subcave {{subcave}} {% endblock title %}
{% block editLink %}<a href={{subcave.get_admin_url}}>Edit subcave {{subcave|wiki_to_html_short}}</a>{% endblock %}
{% block contentheader %}
{{subcave.title}}
{% endblock contentheader %}
{% block content %}
{% block related %}
<h2>Related places</h2>
<h3>Parent</h3>
<ul>
{% if subcave.parent %}
<li><a href="{{subcave.parent.get_absolute_url}}">{{subcave.parent}}</a></li>
{% else %}
<li><a href="{{subcave.cave.get_absolute_url}}">{{subcave.cave}}</a></li>
{% endif %}
</ul>
<h3>Connected subareas</h3>
<ul>
{% for sibling in subcave.adjoining.all%}
<li><a href="{{sibling.get_absolute_url}}">{{silbling}}</a></li>
{% endfor %}
</ul>
<h3>Children</h3>
<ul>
{% for child in subcave.children.all %}
<li><a href="{{child.get_absolute_url}}">{{child}}</a></li>
{% endfor %}
</ul>
{% endblock %}
ok here comes the drilldown<br />
{% drilldown_tree_for_node subcave as drilldown %}
{% for each in drilldown %}
{{ each }}>
{% endfor %}
<h2>{{subcave}}</h2>
<p>
{{subcave.description}}
</p>
{% endblock content %}

View File

@ -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