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

dlete todo page, partly fix other url pages

This commit is contained in:
Philip Sargent 2020-06-04 23:00:58 +01:00
parent b7fea2042f
commit 43c6e2f2e1
7 changed files with 85 additions and 168 deletions

View File

@ -150,32 +150,32 @@ def get_name(pe):
else: else:
return pe.person.first_name return pe.person.first_name
#class UploadFileForm(forms.Form): class UploadFileForm(forms.Form):
# title = forms.CharField(max_length=50) title = forms.CharField(max_length=50)
# file = forms.FileField() file = forms.FileField()
# html = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 30})) html = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 30}))
# lon_utm = forms.FloatField(required=False) lon_utm = forms.FloatField(required=False)
# lat_utm = forms.FloatField(required=False) lat_utm = forms.FloatField(required=False)
# slug = forms.CharField(max_length=50) slug = forms.CharField(max_length=50)
# date = forms.DateField(required=False) date = forms.DateField(required=False)
# caves = [cave.slug for cave in Cave.objects.all()] caves = [cave.slug for cave in Cave.objects.all()]
# caves.sort() #caves.sort()
# caves = ["-----"] + caves caves = ["-----"] + caves
# cave = forms.ChoiceField([(c, c) for c in caves], required=False) cave = forms.ChoiceField([(c, c) for c in caves], required=False)
# entrance = forms.ChoiceField([("-----", "Please select a cave"), ], required=False) entrance = forms.ChoiceField([("-----", "Please select a cave"), ], required=False)
# qm = forms.ChoiceField([("-----", "Please select a cave"), ], required=False) qm = forms.ChoiceField([("-----", "Please select a cave"), ], required=False)
# expeditions = [e.year for e in Expedition.objects.all()] expeditions = [e.year for e in Expedition.objects.all()]
# expeditions.sort() expeditions.sort()
# expeditions = ["-----"] + expeditions expeditions = ["-----"] + expeditions
# expedition = forms.ChoiceField([(e, e) for e in expeditions], required=False) expedition = forms.ChoiceField([(e, e) for e in expeditions], required=False)
# logbookentry = forms.ChoiceField([("-----", "Please select an expedition"), ], required=False) logbookentry = forms.ChoiceField([("-----", "Please select an expedition"), ], required=False)
# person = forms.ChoiceField([("-----", "Please select an expedition"), ], required=False) person = forms.ChoiceField([("-----", "Please select an expedition"), ], required=False)
# survey_point = forms.CharField() survey_point = forms.CharField()

View File

@ -13,6 +13,7 @@ from troggle.core.models import Expedition, Person, PersonExpedition
from troggle.core.models_caves import LogbookEntry, QM, Cave, PersonTrip from troggle.core.models_caves import LogbookEntry, QM, Cave, PersonTrip
from troggle.core.models_survex import SurvexLeg from troggle.core.models_survex import SurvexLeg
from troggle.helper import login_required_if_public from troggle.helper import login_required_if_public
from troggle.core.forms import UploadFileForm
def showrequest(request): def showrequest(request):
@ -52,20 +53,6 @@ def frontpage(request):
from django.contrib.admin.templatetags import log from django.contrib.admin.templatetags import log
return render(request,'frontpage.html', locals()) return render(request,'frontpage.html', locals())
def todo(request):
message = "no test message" #reverse('personn', kwargs={"name":"hkjhjh"})
if "reloadexpos" in request.GET:
message = LoadPersonsExpos()
message = "Reloaded personexpos"
if "reloadsurvex" in request.POST:
message = LoadAllSurvexBlocks()
message = "Reloaded survexblocks"
expeditions = Expedition.objects.order_by("-year")
totallogbookentries = LogbookEntry.objects.count()
return render(request,'index.html', {'expeditions':expeditions, 'all':'all', 'totallogbookentries':totallogbookentries, "message":message})
def controlPanel(request): def controlPanel(request):
jobs_completed=[] jobs_completed=[]
if request.method=='POST': if request.method=='POST':
@ -146,6 +133,7 @@ def eyecandy(request):
return return
def ajax_QM_number(request): def ajax_QM_number(request):
res=""
if request.method=='POST': if request.method=='POST':
cave=Cave.objects.get(id=request.POST['cave']) cave=Cave.objects.get(id=request.POST['cave'])
print(cave) print(cave)
@ -214,57 +202,57 @@ def logbook_entry_suggestions(request):
@login_required_if_public @login_required_if_public
def newFile(request, pslug = None): def newFile(request, pslug = None):
# if pslug: if pslug:
# previousfile = LogbookEntry.objects.get(slug = pslug, date = previousdate, expedition = expedition) previousfile = LogbookEntry.objects.get(slug = pslug, date = previousdate, expedition = expedition)
# assert previousfile.filename assert previousfile.filename
if request.method == 'POST': # If the form has been submitted... if request.method == 'POST': # If the form has been submitted...
tripForm = TripForm(request.POST) # A form bound to the POST data tripForm = TripForm(request.POST) # A form bound to the POST data
# personTripFormSet = PersonTripFormSet(request.POST) personTripFormSet = PersonTripFormSet(request.POST)
# if tripForm.is_valid() and personTripFormSet.is_valid(): # All validation rules pass if tripForm.is_valid() and personTripFormSet.is_valid(): # All validation rules pass
# dateStr = tripForm.cleaned_data["date"].strftime("%Y-%m-%d") dateStr = tripForm.cleaned_data["date"].strftime("%Y-%m-%d")
# directory = os.path.join(settings.EXPOWEB, directory = os.path.join(settings.EXPOWEB,
# "years", "years",
# expedition.year, expedition.year,
# "autologbook") "autologbook")
# filename = os.path.join(directory, filename = os.path.join(directory,
# dateStr + "." + slugify(tripForm.cleaned_data["title"])[:50] + ".html") dateStr + "." + slugify(tripForm.cleaned_data["title"])[:50] + ".html")
# if not os.path.isdir(directory): if not os.path.isdir(directory):
# os.mkdir(directory) os.mkdir(directory)
# if pslug and pdate: if pslug and pdate:
# delLogbookEntry(previouslbe) delLogbookEntry(previouslbe)
# f = open(filename, "w") f = open(filename, "w")
# template = loader.get_template('dataformat/logbookentry.html') template = loader.get_template('dataformat/logbookentry.html')
# context = Context({'trip': tripForm.cleaned_data, context = Context({'trip': tripForm.cleaned_data,
# 'persons': personTripFormSet.cleaned_data, 'persons': personTripFormSet.cleaned_data,
# 'date': dateStr, 'date': dateStr,
# 'expeditionyear': expeditionyear}) 'expeditionyear': expeditionyear})
# f.write(template.render(context)) f.write(template.render(context))
# f.close() f.close()
# print logbookparsers.parseAutoLogBookEntry(filename) print(logbookparsers.parseAutoLogBookEntry(filename))
# return HttpResponseRedirect(reverse('expedition', args=[expedition.year])) # Redirect after POST return HttpResponseRedirect(reverse('expedition', args=[expedition.year])) # Redirect after POST
else: else:
if pslug: if pslug:
pass pass
# if previouslbe.cave: # if previouslbe.cave:
# tripForm = TripForm(initial={"date": previousdate, # tripForm = TripForm(initial={"date": previousdate,
# "title": previouslbe.title, # "title": previouslbe.title,
# "cave": previouslbe.cave.reference(), # "cave": previouslbe.cave.reference(),
# "location": None, # "location": None,
# "caveOrLocation": "cave", # "caveOrLocation": "cave",
# "html": previouslbe.text}) # "html": previouslbe.text})
# else: # else:
# tripForm = TripForm(initial={"date": previousdate, # tripForm = TripForm(initial={"date": previousdate,
# "title": previouslbe.title, # "title": previouslbe.title,
# "cave": None, # "cave": None,
# "location": previouslbe.place, # "location": previouslbe.place,
# "caveOrLocation": "location", # "caveOrLocation": "location",
# "html": previouslbe.text}) # "html": previouslbe.text})
# personTripFormSet = PersonTripFormSet(initial=[{"name": get_name(py.personexpedition), # personTripFormSet = PersonTripFormSet(initial=[{"name": get_name(py.personexpedition),
# "TU": py.time_underground, # "TU": py.time_underground,
# "author": py.is_logbook_entry_author} # "author": py.is_logbook_entry_author}
# for py in previouslbe.persontrip_set.all()]) # for py in previouslbe.persontrip_set.all()])
# else: else:
# fileform = UploadFileForm() # An unbound form fileform = UploadFileForm() # An unbound form
return render(request, 'editfile.html', { return render(request, 'editfile.html', {
'fileForm': fileform, 'fileForm': fileform,

View File

@ -46,12 +46,12 @@ Here you will find information about the {{expedition.objects.count}} expedition
</p> </p>
<p class="indent"> <p class="indent">
If you are an expedition member, please sign up using the link to the top right. You are not logged-in, so not all the pages will be visible and you will not be able to edit anything.
</p> </p>
{% endblock content %} {% endblock content %}
{% block margins %} {% block margins %}
<img class="leftMargin eyeCandy fadeIn" src="{{ settings.MEDIA_URL }}eieshole.jpg"> <img src="{{ settings.MEDIA_URL }}eieshole.jpg">
<img class="rightMargin eyeCandy fadeIn" src="{{ settings.MEDIA_URL }}goesser.jpg"> <img src="{{ settings.MEDIA_URL }}goesser.jpg">
{% endblock margins %} {% endblock margins %}

View File

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

View File

@ -12,25 +12,16 @@
<li><a href="">Upload a photo</a></li> <li><a href="">Upload a photo</a></li>
<li><a href="">Record a new trip</a></li> <li><a href="">Record a new trip</a></li>
<h3>Your unfinished business</h3> <h3>Unfinished wallets work to do:</h3>
{% for survey in surveys_unfinished %} {% for survey in surveys_unfinished %}
<li>{{survey|link}}</li> <li>{{survey|link}}</li>
{% endfor %} {% endfor %}
<h3>General unfinished business</h3>
add wikilinks
<h3>Caving recommendations</h3> <h3>Caving recommendations</h3>
{% for qm in qms_recommended %} {% for qm in qms_recommended %}
<li>{{qm|link}}</li> <li>{{qm|link}}</li>
{% endfor %} {% endfor %}
<h3>Profile tasks</h3>
<li>Dates present on expo</li>
<li>Mugshot</li>
<li>Blurb</li>
{% endblock content %} {% endblock content %}
{% block margins %} {% block margins %}

View File

@ -1,61 +0,0 @@
{% extends "base.html" %}
{% load wiki_markup %}
{% block title %}Cambridge Expeditions to Austria{% endblock %}
{% block content %}
<h2>The unfinished front page</h2>
<ul>
<li><b>About {{totallogbookentries}} logbook entries have been loaded</b></li>
<li><b><a href="{% url "personindex" %}">List of People</a></b></li>
<li><b><a href="{% url "caveindex" %}">List of Caves</a></b></li>
<li><a href="{% url "jgtfile" aaaa %}">JGT list of files</a> (temporary simple file list and tunnel use)</li>
<li><a href="{% url "survey" %}">Survey files</a></li>
<li><a href="{% url "survexindex" all %}">Survex directory</a></li>
<li><a href="{% url "expedition" 2008 %}">Expedition 2008</a></li>
<li><a href="{% url "expedition" 2007 %}">Expedition 2007</a></li>
<li><a href="{% url "expedition" 1993 %}">Expedition 1993</a> (earliest parsed)</li>
</ul>
<h2>Further work</h2>
<p>Please see the <a href="http://code.google.com/p/troggle/issues/list">issues</a> tracker on google code. You can contribute new feature requests and bug reports.</p>
<p>Julian's work:
<p>parse 1992-1976 logbooks; (esp top 161)</p>
<p>detect T/U on log entries; </p>
<p>name matching and spelling in survex files; </p>
<p>Improve logbook wikihtml text</p>
<p>Other work:</p>
<p>surf through the tunnel sketches and images</p>
<p>bugs with all.svx block (double dot)
<p>render bitmap view of every survex block as a thumbnail</p>
<p>upload tunnel images and tunnel sketches</p>
<p>where are the subcaves; </p>
<p>cave section entrance match for logbook entries</p>
<p>simplify the survex parsing code (if necessary); </p>
<p>wiki survex stop linegap between comment lins</p>
<p>links between logbooks and survex blocks to cave things; </p>
<p>mini-tree of survexblocks; </p>
<p>connect sketches to caves to survey blocks and render thumbnailwise; </p>
<p>all images to start appearing in pages; and so on</p>
<h3>{{message}}</h3>
<form action="" method="GET">
<input type="submit" name="reloadexpos" value="Reload Expos">
<input type="submit" name="reloadsurvex" value="Reload Survex">
</form>
<ul id="expeditionlist">
{% for expedition in expeditions %}
<li>
<a href="{% url "expedition" expedition.year %}">{{expedition.name}}</a>
- <b>{{expedition.logbookentry_set.count}}</b> logbook entries
</li>
{% endfor %}
</ul>
{% endblock %}

19
urls.py
View File

@ -22,13 +22,12 @@ admin.autodiscover()
actualurlpatterns = patterns('', actualurlpatterns = patterns('',
url(r'^troggle$', views_other.frontpage, name="frontpage"), url(r'^troggle$', views_other.frontpage, name="frontpage"),
url(r'^todo/$', views_other.todo, name="todo"),
url(r'^caves/?$', views_caves.caveindex, name="caveindex"), url(r'^caves/?$', views_caves.caveindex, name="caveindex"),
url(r'^people/?$', views_logbooks.personindex, name="personindex"), url(r'^people/?$', views_logbooks.personindex, name="personindex"),
url(r'^newqmnumber/?$', views_other.ajax_QM_number, ), url(r'^newqmnumber/?$', views_other.ajax_QM_number, ),
url(r'^lbo_suggestions/?$', logbook_entry_suggestions), url(r'^lbo_suggestions/?$', logbook_entry_suggestions), #broken
#(r'^person/(?P<person_id>\d*)/?$', views_logbooks.person), #(r'^person/(?P<person_id>\d*)/?$', views_logbooks.person),
url(r'^person/(?P<first_name>[A-Z]*[a-z\-\'&;]*)[^a-zA-Z]*(?P<last_name>[a-z\-\']*[^a-zA-Z]*[A-Z]*[a-z\-&;]*)/?', views_logbooks.person, name="person"), url(r'^person/(?P<first_name>[A-Z]*[a-z\-\'&;]*)[^a-zA-Z]*(?P<last_name>[a-z\-\']*[^a-zA-Z]*[A-Z]*[a-z\-&;]*)/?', views_logbooks.person, name="person"),
#url(r'^person/(\w+_\w+)$', views_logbooks.person, name="person"), #url(r'^person/(\w+_\w+)$', views_logbooks.person, name="person"),
@ -38,14 +37,14 @@ actualurlpatterns = patterns('',
url(r'^personexpedition/(?P<first_name>[A-Z]*[a-z&;]*)[^a-zA-Z]*(?P<last_name>[A-Z]*[a-zA-Z&;]*)/(?P<year>\d+)/?$', views_logbooks.personexpedition, name="personexpedition"), url(r'^personexpedition/(?P<first_name>[A-Z]*[a-z&;]*)[^a-zA-Z]*(?P<last_name>[A-Z]*[a-zA-Z&;]*)/(?P<year>\d+)/?$', views_logbooks.personexpedition, name="personexpedition"),
url(r'^logbookentry/(?P<date>.*)/(?P<slug>.*)/?$', views_logbooks.logbookentry,name="logbookentry"), url(r'^logbookentry/(?P<date>.*)/(?P<slug>.*)/?$', views_logbooks.logbookentry,name="logbookentry"),
url(r'^newlogbookentry/(?P<expeditionyear>.*)$', views_logbooks.newLogbookEntry, name="newLogBookEntry"), url(r'^newlogbookentry/(?P<expeditionyear>.*)$', views_logbooks.newLogbookEntry, name="newLogBookEntry"),
url(r'^editlogbookentry/(?P<expeditionyear>[^/]*)/(?P<pdate>[^/]*)/(?P<pslug>[^/]*)/$', views_logbooks.newLogbookEntry, name="editLogBookEntry"), url(r'^editlogbookentry/(?P<expeditionyear>[^/]*)/(?P<pdate>[^/]*)/(?P<pslug>[^/]*)/$', views_logbooks.newLogbookEntry, name="editLogBookEntry"), # working !
url(r'^deletelogbookentry/(?P<expeditionyear>[^/]*)/(?P<date>[^/]*)/(?P<slug>[^/]*)/$', views_logbooks.deleteLogbookEntry, name="deleteLogBookEntry"), url(r'^deletelogbookentry/(?P<expeditionyear>[^/]*)/(?P<date>[^/]*)/(?P<slug>[^/]*)/$', views_logbooks.deleteLogbookEntry, name="deleteLogBookEntry"),
url(r'^newfile', views_other.newFile, name="newFile"), url(r'^newfile', views_other.newFile, name="newFile"), # oddly broken, needs investigating more
url(r'^getEntrances/(?P<caveslug>.*)', views_caves.get_entrances, name = "get_entrances"), url(r'^getEntrances/(?P<caveslug>.*)', views_caves.get_entrances, name = "get_entrances"), #works
url(r'^getQMs/(?P<caveslug>.*)', views_caves.get_qms, name = "get_qms"), # no template "get_qms"? url(r'^getQMs/(?P<caveslug>.*)', views_caves.get_qms, name = "get_qms"), # no template "get_qms"?
url(r'^getPeople/(?P<expeditionslug>.*)', views_logbooks.get_people, name = "get_people"), url(r'^getPeople/(?P<expeditionslug>.*)', views_logbooks.get_people, name = "get_people"), # fails
url(r'^getLogBookEntries/(?P<expeditionslug>.*)', views_logbooks.get_logbook_entries, name = "get_logbook_entries"), url(r'^getLogBookEntries/(?P<expeditionslug>.*)', views_logbooks.get_logbook_entries, name = "get_logbook_entries"), #works
url(r'^cave/new/$', views_caves.edit_cave, name="newcave"), url(r'^cave/new/$', views_caves.edit_cave, name="newcave"),
url(r'^cave/(?P<cave_id>[^/]+)/?$', views_caves.cave, name="cave"), url(r'^cave/(?P<cave_id>[^/]+)/?$', views_caves.cave, name="cave"),
@ -61,8 +60,8 @@ actualurlpatterns = patterns('',
#url(r'^cavehref/(.+)$', views_caves.cave, name="cave"),url(r'cave'), #url(r'^cavehref/(.+)$', views_caves.cave, name="cave"),url(r'cave'),
url(r'^cave/3d/(?P<cave_id>[^/]+).3d$', views_caves.cave3d, name="cave3d"), url(r'^cave/3d/(?P<cave_id>[^/]+).3d$', views_caves.cave3d, name="cave3d"),
# url(r'^jgtfile/(.*)$', view_surveys.jgtfile, name="jgtfile"), url(r'^jgtfile/(.*)$', view_surveys.jgtfile, name="jgtfile"),
# url(r'^jgtuploadfile$', view_surveys.jgtuploadfile, name="jgtuploadfile"), url(r'^jgtuploadfile$', view_surveys.jgtuploadfile, name="jgtuploadfile"),
url(r'^cave/(?P<cave_id>[^/]+)/?(?P<ent_letter>[^/])$', ent), url(r'^cave/(?P<cave_id>[^/]+)/?(?P<ent_letter>[^/])$', ent),
url(r'^cave/(?P<slug>[^/]+)/edit/$', views_caves.edit_cave, name="edit_cave"), url(r'^cave/(?P<slug>[^/]+)/edit/$', views_caves.edit_cave, name="edit_cave"),