mirror of
https://expo.survex.com/repositories/expoweb/.git/
synced 2024-11-23 07:41:56 +00:00
[svn r8269] Got QM pages working.
Started scripts for exporting to old expo format.
This commit is contained in:
parent
f96195cdab
commit
17a7302afb
@ -5,6 +5,14 @@ from troggle.expo.forms import CaveForm
|
||||
import search
|
||||
from troggle.alwaysUseRequestContext import render_response # see views_logbooks for explanation on this.
|
||||
|
||||
def getCave(cave_id):
|
||||
"""Returns a cave object when given a cave name or number. It is used by views including cavehref, ent, and qm."""
|
||||
try:
|
||||
cave = Cave.objects.get(kataster_number=cave_id)
|
||||
except Cave.DoesNotExist:
|
||||
cave = Cave.objects.get(unofficial_number=cave_id)
|
||||
return cave
|
||||
|
||||
def caveindex(request):
|
||||
caves = Cave.objects.all()
|
||||
notablecavehrefs = [ "161", "204", "258", "76" ] # could detect notability by trips and notability of people who have been down them
|
||||
@ -12,12 +20,12 @@ def caveindex(request):
|
||||
return render_response(request,'caveindex.html', {'caves': caves, 'notablecaves':notablecaves})
|
||||
|
||||
def cavehref(request, cave_id='', offical_name=''):
|
||||
try:
|
||||
cave = Cave.objects.get(kataster_number=cave_id)
|
||||
except Cave.DoesNotExist:
|
||||
cave = Cave.objects.get(unofficial_number=cave_id)
|
||||
return render_response(request,'cave.html', {'cave': cave,})
|
||||
return render_response(request,'cave.html', {'cave': getCave(cave_id),})
|
||||
|
||||
def qm(request,cave_id,qm_id,year):
|
||||
year=int(year)
|
||||
qm=getCave(cave_id).get_QMs().get(number=qm_id,found_by__date__year=year)
|
||||
return render_response(request,'qm.html',{'qm':qm,})
|
||||
|
||||
def ent(request, cave_id, ent_letter):
|
||||
cave = Cave.objects.filter(kataster_number = cave_id)[0]
|
||||
|
0
troggle/export/__init__.py
Normal file
0
troggle/export/__init__.py
Normal file
79
troggle/export/tocavetab.py
Normal file
79
troggle/export/tocavetab.py
Normal file
@ -0,0 +1,79 @@
|
||||
import troggle.expo.models as models
|
||||
from django.conf import settings
|
||||
|
||||
import csv
|
||||
import re
|
||||
import os
|
||||
|
||||
##format of CAVETAB2.CSV is
|
||||
KatasterNumber = 0
|
||||
KatStatusCode = 1
|
||||
Entrances = 2
|
||||
UnofficialNumber = 3
|
||||
MultipleEntrances = 4
|
||||
AutogenFile = 5
|
||||
LinkFile = 6
|
||||
LinkEntrance = 7
|
||||
Name = 8
|
||||
UnofficialName = 9
|
||||
Comment = 10
|
||||
Area = 11
|
||||
Explorers = 12
|
||||
UndergroundDescription = 13
|
||||
Equipment = 14
|
||||
QMList = 15
|
||||
KatasterStatus = 16
|
||||
References = 17
|
||||
UndergroundCentreLine = 18
|
||||
UndergroundDrawnSurvey = 19
|
||||
SurvexFile = 20
|
||||
Length = 21
|
||||
Depth = 22
|
||||
Extent = 23
|
||||
Notes = 24
|
||||
EntranceName = 25
|
||||
TagPoint = 26
|
||||
OtherPoint = 27
|
||||
DescriptionOfOtherPoint = 28
|
||||
ExactEntrance = 29
|
||||
TypeOfFix = 30
|
||||
GPSpreSA = 31
|
||||
GPSpostSA = 32
|
||||
Northing = 33
|
||||
Easting = 34
|
||||
Altitude = 35
|
||||
Bearings = 36
|
||||
Map = 37
|
||||
Location = 38
|
||||
Approach = 39
|
||||
EntranceDescription = 40
|
||||
PhotoOfLocation = 41
|
||||
Marking = 42
|
||||
MarkingComment = 43
|
||||
Findability = 44
|
||||
FindabilityComment = 45
|
||||
|
||||
##format of CAVETAB2.CSV is
|
||||
headers=['KatasterNumber','KatStatusCode','Entrances','UnofficialNumber','MultipleEntrances','AutogenFile','LinkFile','LinkEntrance','Name','UnofficialName',
|
||||
'Comment','Area','Explorers','UndergroundDescription','Equipment','QMList','KatasterStatus','References','UndergroundCentreLine','UndergroundDrawnSurvey',
|
||||
'SurvexFile','Length','Depth','Extent','Notes','EntranceName','TagPoint','OtherPoint','DescriptionOfOtherPoint','ExactEntrance','TypeOfFix','GPSpreSA',
|
||||
'GPSpostSA','Northing','Easting','Altitude','Bearings','Map','Location','Approach','EntranceDescription','PhotoOfLocation','Marking','MarkingComment',
|
||||
'Findability','FindabilityComment']
|
||||
headersDict={}
|
||||
x=0
|
||||
for column in headers:
|
||||
headersDict[x]=column
|
||||
x+=1
|
||||
print headersDict
|
||||
|
||||
def writeCaveTab(path):
|
||||
outfile=file(path,'w')
|
||||
cavewriter=csv.writer(outfile)
|
||||
cavewriter.writerows
|
||||
for cave in Cave.objects.all():
|
||||
caverow[KatasterNumber]=cave.kataster_number
|
||||
caverow[KatStatusCode]=cave.katasternumber
|
||||
|
||||
def addCell(caverow, attribute):
|
||||
caverow[attribute]=cave.attribute
|
||||
|
0
troggle/export/tologbooks.py
Normal file
0
troggle/export/tologbooks.py
Normal file
0
troggle/export/toqms.py
Normal file
0
troggle/export/toqms.py
Normal file
@ -48,8 +48,12 @@ def parseCaveQMs(cave,pathToCSV):
|
||||
newQM.grade=line[1]
|
||||
newQM.area=line[2]
|
||||
newQM.location_description=line[3]
|
||||
newQM.nearest_station_description=line[4]
|
||||
newQM.completion_description=line[5]
|
||||
|
||||
newQM.completion_description=line[4]
|
||||
newQM.nearest_station_description=line[5]
|
||||
if newQM.completion_description: # Troggle checks if QMs are completed by checking if they have a ticked_off_by trip. In the table, completion is indicated by the presence of a completion discription.
|
||||
newQM.ticked_off_by=placeholder
|
||||
|
||||
newQM.comment=line[6]
|
||||
newQM.save()
|
||||
print "QM "+str(newQM) + ' added to database\r',
|
||||
|
@ -4,7 +4,7 @@
|
||||
{% block content %}
|
||||
|
||||
<div id="col2">
|
||||
<h3>All trips done in this cave</h3>
|
||||
<h3>All logbook entries regarding this cave ({{cave.logbookentry_set.count}})</h3>
|
||||
<table>
|
||||
{% for logbookentry in cave.logbookentry_set.all %}
|
||||
{% if logbookentry.title %}
|
||||
@ -64,4 +64,25 @@
|
||||
<h2>Notes</h2>
|
||||
{{ cave.notes|wiki_to_html }}
|
||||
{% endif %}
|
||||
|
||||
{% if cave.get_QMs %}
|
||||
<h2>Question marks</h2>
|
||||
<h3>Extant</h3>
|
||||
<ul>
|
||||
{% for QM in cave.get_QMs %}
|
||||
{% if QM.ticked_off_by %}
|
||||
{% else %}
|
||||
<li><a href="{{QM.get_absolute_url}}">{{QM}}</a></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<h3>Ticked off</h3>
|
||||
<ul>
|
||||
{% for QM in cave.get_QMs %}
|
||||
{% if QM.ticked_off_by %}
|
||||
<li><a href="{{QM.get_absolute_url}}">{{QM}}</a></li>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
40
troggle/templates/qm.html
Normal file
40
troggle/templates/qm.html
Normal file
@ -0,0 +1,40 @@
|
||||
{% extends "base.html" %}
|
||||
{% load wiki_markup %}
|
||||
|
||||
{% block title %} QM: {{qm|wiki_to_html_short}} {% endblock %}
|
||||
|
||||
{% block editLink %}| <a href={{qm.get_admin_url}}>Edit QM {{qm|wiki_to_html_short}}</a>{% endblock %}
|
||||
|
||||
|
||||
|
||||
{% block contentheader %}
|
||||
<table id="cavepage">
|
||||
<tr>
|
||||
<th id="kat_no"><a href="{{qm.get_previous_by_id.get_absolute_url}}">Previous</a></th>
|
||||
<th id="name">{{qm|wiki_to_html_short}}</th>
|
||||
<th id="status"><a href="{{qm.get_next_by_id.get_absolute_url}}">Next</a></th>
|
||||
</tr>
|
||||
</table>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h3>Location</h3>
|
||||
{{qm.location_description}}
|
||||
|
||||
|
||||
<h3>Creation</h3>
|
||||
Found by <a href="{{qm.found_by.get_absolute_url}}">{{qm.found_by}}</a> on {{qm.found_by.date}}.
|
||||
|
||||
<h3>Completion</h3>
|
||||
{% if ticked_off_by %}
|
||||
{{qm.completion_description}}
|
||||
Ticked off by: <a href="{{qm.ticked_off_by.get_absolute_url}}">{{qm.ticked_off_by}}</a><br />
|
||||
Description: {{qm.completion_description}}
|
||||
{% else %}
|
||||
None yet- STILL EXTANT.
|
||||
{% endif %}
|
||||
|
||||
<h3>Comment</h3>
|
||||
{{qm.comment}}
|
||||
|
||||
{% endblock %}
|
@ -27,7 +27,7 @@ urlpatterns = patterns('',
|
||||
|
||||
url(r'^survexblock/(.+)$', views_caves.survexblock, name="survexblock"),
|
||||
url(r'^cavehref/(.+)$', views_caves.cavehref, name="cave"),
|
||||
|
||||
|
||||
url(r'^jgtfile/(.*)$', view_surveys.jgtfile, name="jgtfile"),
|
||||
url(r'^jgtuploadfile$', view_surveys.jgtuploadfile, name="jgtuploadfile"),
|
||||
|
||||
@ -41,7 +41,8 @@ urlpatterns = patterns('',
|
||||
url(r'^cavearea', caveArea, name="caveArea"),
|
||||
|
||||
url(r'^survex/(.*?)\.index$', views_survex.index, name="survexindex"),
|
||||
url(r'^cave/(?P<cave_id>[^/]+)/?$', views_caves.cavehref), # deprecated
|
||||
url(r'^cave/(?P<cave_id>[^/]+)/?$', views_caves.cavehref),
|
||||
url(r'^cave/(?P<cave_id>[^/]+)/(?P<year>\d\d\d\d)-(?P<qm_id>\d\d)?$', views_caves.qm),
|
||||
(r'^survex/(?P<survex_file>.*)\.svx$', svx),
|
||||
(r'^survex/(?P<survex_file>.*)\.3d$', threed),
|
||||
(r'^survex/(?P<survex_file>.*)\.log$', log),
|
||||
|
Loading…
Reference in New Issue
Block a user