summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@klebos.com>2020-06-04 23:00:58 +0100
committerPhilip Sargent <philip.sargent@klebos.com>2020-06-04 23:00:58 +0100
commit43c6e2f2e1a462132cacc5d7b6af34a08f5ff585 (patch)
treec5666ba7709d41031e91204e29a49aed7007e4a8
parentb7fea2042feb5ad12d99e7279498ad68c00c983b (diff)
downloadtroggle-43c6e2f2e1a462132cacc5d7b6af34a08f5ff585.tar.gz
troggle-43c6e2f2e1a462132cacc5d7b6af34a08f5ff585.tar.bz2
troggle-43c6e2f2e1a462132cacc5d7b6af34a08f5ff585.zip
dlete todo page, partly fix other url pages
-rw-r--r--core/forms.py54
-rw-r--r--core/views_other.py110
-rw-r--r--templates/frontpage.html6
-rw-r--r--templates/qm.html2
-rw-r--r--templates/tasks.html11
-rw-r--r--templates/todo.html61
-rw-r--r--urls.py19
7 files changed, 90 insertions, 173 deletions
diff --git a/core/forms.py b/core/forms.py
index 8abf32a..0cd156f 100644
--- a/core/forms.py
+++ b/core/forms.py
@@ -150,32 +150,32 @@ def get_name(pe):
else:
return pe.person.first_name
-#class UploadFileForm(forms.Form):
-# title = forms.CharField(max_length=50)
-# file = forms.FileField()
-# html = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 30}))
-# lon_utm = forms.FloatField(required=False)
-# lat_utm = forms.FloatField(required=False)
-# slug = forms.CharField(max_length=50)
-# date = forms.DateField(required=False)
-
-# caves = [cave.slug for cave in Cave.objects.all()]
-# caves.sort()
-# caves = ["-----"] + caves
-# cave = forms.ChoiceField([(c, c) for c in caves], required=False)
-
-# entrance = 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.sort()
-# expeditions = ["-----"] + expeditions
-# expedition = forms.ChoiceField([(e, e) for e in expeditions], required=False)
-
-# logbookentry = forms.ChoiceField([("-----", "Please select an expedition"), ], required=False)
-
-# person = forms.ChoiceField([("-----", "Please select an expedition"), ], required=False)
-
-# survey_point = forms.CharField()
+class UploadFileForm(forms.Form):
+ title = forms.CharField(max_length=50)
+ file = forms.FileField()
+ html = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 30}))
+ lon_utm = forms.FloatField(required=False)
+ lat_utm = forms.FloatField(required=False)
+ slug = forms.CharField(max_length=50)
+ date = forms.DateField(required=False)
+
+ caves = [cave.slug for cave in Cave.objects.all()]
+ #caves.sort()
+ caves = ["-----"] + caves
+ cave = forms.ChoiceField([(c, c) for c in caves], required=False)
+
+ entrance = 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.sort()
+ expeditions = ["-----"] + expeditions
+ expedition = forms.ChoiceField([(e, e) for e in expeditions], required=False)
+
+ logbookentry = forms.ChoiceField([("-----", "Please select an expedition"), ], required=False)
+
+ person = forms.ChoiceField([("-----", "Please select an expedition"), ], required=False)
+
+ survey_point = forms.CharField()
diff --git a/core/views_other.py b/core/views_other.py
index 87cf724..0b56786 100644
--- a/core/views_other.py
+++ b/core/views_other.py
@@ -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_survex import SurvexLeg
from troggle.helper import login_required_if_public
+from troggle.core.forms import UploadFileForm
def showrequest(request):
@@ -52,20 +53,6 @@ def frontpage(request):
from django.contrib.admin.templatetags import log
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):
jobs_completed=[]
if request.method=='POST':
@@ -146,6 +133,7 @@ def eyecandy(request):
return
def ajax_QM_number(request):
+ res=""
if request.method=='POST':
cave=Cave.objects.get(id=request.POST['cave'])
print(cave)
@@ -214,57 +202,57 @@ def logbook_entry_suggestions(request):
@login_required_if_public
def newFile(request, pslug = None):
-# if pslug:
-# previousfile = LogbookEntry.objects.get(slug = pslug, date = previousdate, expedition = expedition)
-# assert previousfile.filename
+ if pslug:
+ previousfile = LogbookEntry.objects.get(slug = pslug, date = previousdate, expedition = expedition)
+ assert previousfile.filename
if request.method == 'POST': # If the form has been submitted...
tripForm = TripForm(request.POST) # A form bound to the POST data
-# personTripFormSet = PersonTripFormSet(request.POST)
-# if tripForm.is_valid() and personTripFormSet.is_valid(): # All validation rules pass
-# dateStr = tripForm.cleaned_data["date"].strftime("%Y-%m-%d")
-# directory = os.path.join(settings.EXPOWEB,
-# "years",
-# expedition.year,
-# "autologbook")
-# filename = os.path.join(directory,
-# dateStr + "." + slugify(tripForm.cleaned_data["title"])[:50] + ".html")
-# if not os.path.isdir(directory):
-# os.mkdir(directory)
-# if pslug and pdate:
-# delLogbookEntry(previouslbe)
-# f = open(filename, "w")
-# template = loader.get_template('dataformat/logbookentry.html')
-# context = Context({'trip': tripForm.cleaned_data,
-# 'persons': personTripFormSet.cleaned_data,
-# 'date': dateStr,
-# 'expeditionyear': expeditionyear})
-# f.write(template.render(context))
-# f.close()
-# print logbookparsers.parseAutoLogBookEntry(filename)
-# return HttpResponseRedirect(reverse('expedition', args=[expedition.year])) # Redirect after POST
+ personTripFormSet = PersonTripFormSet(request.POST)
+ if tripForm.is_valid() and personTripFormSet.is_valid(): # All validation rules pass
+ dateStr = tripForm.cleaned_data["date"].strftime("%Y-%m-%d")
+ directory = os.path.join(settings.EXPOWEB,
+ "years",
+ expedition.year,
+ "autologbook")
+ filename = os.path.join(directory,
+ dateStr + "." + slugify(tripForm.cleaned_data["title"])[:50] + ".html")
+ if not os.path.isdir(directory):
+ os.mkdir(directory)
+ if pslug and pdate:
+ delLogbookEntry(previouslbe)
+ f = open(filename, "w")
+ template = loader.get_template('dataformat/logbookentry.html')
+ context = Context({'trip': tripForm.cleaned_data,
+ 'persons': personTripFormSet.cleaned_data,
+ 'date': dateStr,
+ 'expeditionyear': expeditionyear})
+ f.write(template.render(context))
+ f.close()
+ print(logbookparsers.parseAutoLogBookEntry(filename))
+ return HttpResponseRedirect(reverse('expedition', args=[expedition.year])) # Redirect after POST
else:
if pslug:
- pass
-# if previouslbe.cave:
-# tripForm = TripForm(initial={"date": previousdate,
-# "title": previouslbe.title,
-# "cave": previouslbe.cave.reference(),
-# "location": None,
-# "caveOrLocation": "cave",
-# "html": previouslbe.text})
-# else:
-# tripForm = TripForm(initial={"date": previousdate,
-# "title": previouslbe.title,
-# "cave": None,
-# "location": previouslbe.place,
-# "caveOrLocation": "location",
-# "html": previouslbe.text})
-# personTripFormSet = PersonTripFormSet(initial=[{"name": get_name(py.personexpedition),
-# "TU": py.time_underground,
-# "author": py.is_logbook_entry_author}
-# for py in previouslbe.persontrip_set.all()])
-# else:
-# fileform = UploadFileForm() # An unbound form
+ pass
+ # if previouslbe.cave:
+ # tripForm = TripForm(initial={"date": previousdate,
+ # "title": previouslbe.title,
+ # "cave": previouslbe.cave.reference(),
+ # "location": None,
+ # "caveOrLocation": "cave",
+ # "html": previouslbe.text})
+ # else:
+ # tripForm = TripForm(initial={"date": previousdate,
+ # "title": previouslbe.title,
+ # "cave": None,
+ # "location": previouslbe.place,
+ # "caveOrLocation": "location",
+ # "html": previouslbe.text})
+ # personTripFormSet = PersonTripFormSet(initial=[{"name": get_name(py.personexpedition),
+ # "TU": py.time_underground,
+ # "author": py.is_logbook_entry_author}
+ # for py in previouslbe.persontrip_set.all()])
+ else:
+ fileform = UploadFileForm() # An unbound form
return render(request, 'editfile.html', {
'fileForm': fileform,
diff --git a/templates/frontpage.html b/templates/frontpage.html
index a11b6f7..5f0bf18 100644
--- a/templates/frontpage.html
+++ b/templates/frontpage.html
@@ -46,12 +46,12 @@ Here you will find information about the {{expedition.objects.count}} expedition
</p>
<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>
{% endblock content %}
{% block margins %}
-<img class="leftMargin eyeCandy fadeIn" src="{{ settings.MEDIA_URL }}eieshole.jpg">
-<img class="rightMargin eyeCandy fadeIn" src="{{ settings.MEDIA_URL }}goesser.jpg">
+<img src="{{ settings.MEDIA_URL }}eieshole.jpg">
+<img src="{{ settings.MEDIA_URL }}goesser.jpg">
{% endblock margins %} \ No newline at end of file
diff --git a/templates/qm.html b/templates/qm.html
index f960197..007dadb 100644
--- a/templates/qm.html
+++ b/templates/qm.html
@@ -24,7 +24,7 @@
<h2>Related items</h2>
Parent cave: {{qm.found_by.cave|link}}
-(todo: add parent survey and parent subcave)
+(to do: add parent survey and parent subcave)
{% block content %}
<h3>Location</h3>
diff --git a/templates/tasks.html b/templates/tasks.html
index 36d35f4..97a924f 100644
--- a/templates/tasks.html
+++ b/templates/tasks.html
@@ -12,25 +12,16 @@
<li><a href="">Upload a photo</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 %}
<li>{{survey|link}}</li>
{% endfor %}
-<h3>General unfinished business</h3>
-add wikilinks
-
<h3>Caving recommendations</h3>
{% for qm in qms_recommended %}
<li>{{qm|link}}</li>
{% endfor %}
-<h3>Profile tasks</h3>
-
-<li>Dates present on expo</li>
-<li>Mugshot</li>
-<li>Blurb</li>
-
{% endblock content %}
{% block margins %}
diff --git a/templates/todo.html b/templates/todo.html
deleted file mode 100644
index 7482b72..0000000
--- a/templates/todo.html
+++ /dev/null
@@ -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 %}
diff --git a/urls.py b/urls.py
index 0044633..523b1a7 100644
--- a/urls.py
+++ b/urls.py
@@ -22,13 +22,12 @@ admin.autodiscover()
actualurlpatterns = patterns('',
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'^people/?$', views_logbooks.personindex, name="personindex"),
- url(r'^newqmnumber/?$', views_other.ajax_QM_number, ),
- url(r'^lbo_suggestions/?$', logbook_entry_suggestions),
+ url(r'^newqmnumber/?$', views_other.ajax_QM_number, ),
+ url(r'^lbo_suggestions/?$', logbook_entry_suggestions), #broken
#(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/(\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'^logbookentry/(?P<date>.*)/(?P<slug>.*)/?$', views_logbooks.logbookentry,name="logbookentry"),
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'^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'^getPeople/(?P<expeditionslug>.*)', views_logbooks.get_people, name = "get_people"),
- url(r'^getLogBookEntries/(?P<expeditionslug>.*)', views_logbooks.get_logbook_entries, name = "get_logbook_entries"),
+ 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"), #works
url(r'^cave/new/$', views_caves.edit_cave, name="newcave"),
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'^cave/3d/(?P<cave_id>[^/]+).3d$', views_caves.cave3d, name="cave3d"),
-# url(r'^jgtfile/(.*)$', view_surveys.jgtfile, name="jgtfile"),
-# url(r'^jgtuploadfile$', view_surveys.jgtuploadfile, name="jgtuploadfile"),
+ url(r'^jgtfile/(.*)$', view_surveys.jgtfile, name="jgtfile"),
+ url(r'^jgtuploadfile$', view_surveys.jgtuploadfile, name="jgtuploadfile"),
url(r'^cave/(?P<cave_id>[^/]+)/?(?P<ent_letter>[^/])$', ent),
url(r'^cave/(?P<slug>[^/]+)/edit/$', views_caves.edit_cave, name="edit_cave"),