[svn r8189] new person expedition

This commit is contained in:
julian 2009-01-18 20:50:30 +01:00
parent 05469fa333
commit 2f0eb4f25f
13 changed files with 152 additions and 64 deletions

View File

@ -6,7 +6,7 @@
<title>1623:0</title>
</head>
<body>
<h1>Altausseer See north shore vauclusian risings</h1>
<h1>AltausseeEEEEr See north shore vauclusian risings</h1>
<p>A walk around Altausseer See reveals few streams flowing in to the lake,
but a sizeable river flowing out, fuelling speculation that there were

View File

@ -45,6 +45,8 @@ class Person(models.Model):
is_vfho = models.BooleanField(help_text="VFHO is the Vereines f&uuml;r H&ouml;hlenkunde in Obersteier, a nearby Austrian caving club.")
mug_shot = models.CharField(max_length=100, blank=True,null=True)
blurb = models.TextField(blank=True,null=True)
href = models.CharField(max_length=200)
class Meta:
verbose_name_plural = "People"
@ -53,12 +55,6 @@ class Person(models.Model):
return "%s %s" % (self.first_name, self.last_name)
return self.first_name
# this should be a member entry
def href(self):
if self.last_name:
return "%s_%s" % (self.first_name.lower(), self.last_name.lower())
return self.first_name.lower()
class PersonExpedition(models.Model):
expedition = models.ForeignKey(Expedition)
@ -205,9 +201,10 @@ class LogbookEntry(models.Model):
expedition = models.ForeignKey(Expedition,blank=True,null=True) # yes this is double-
author = models.ForeignKey(PersonExpedition,blank=True,null=True) # the person who writes it up doesn't have to have been on the trip
title = models.CharField(max_length=200)
cave = models.ForeignKey(Cave,blank=True,null=True)
cave = models.ForeignKey(Cave,blank=True,null=True)
place = models.CharField(max_length=100,blank=True,null=True)
text = models.TextField()
href = models.CharField(max_length=100)
logbookentry_next = models.ForeignKey('LogbookEntry', related_name='pnext', blank=True,null=True)
logbookentry_prev = models.ForeignKey('LogbookEntry', related_name='pprev', blank=True,null=True)

View File

@ -1,5 +1,6 @@
from django.db import models
import troggle.settings as settings
import os
class SurvexBlock(models.Model):
name = models.CharField(max_length=100, blank=True, null=True)
@ -11,15 +12,28 @@ class SurvexBlock(models.Model):
end_year = models.IntegerField(blank=True, null=True)
end_month = models.IntegerField(blank=True, null=True)
end_day = models.IntegerField(blank=True, null=True)
person = models.ManyToManyField('Person', through='PersonRole', blank=True, null=True)
begin_file = models.CharField(max_length=200)
begin_char = models.IntegerField()
end_file = models.CharField(max_length=200, blank=True, null=True)
end_char = models.IntegerField(blank=True, null=True)
def __unicode__(self):
return unicode(self.name)
def filecontents(self):
f = os.path.join(settings.SURVEX_DATA, self.begin_file)
fin = open(f)
res = fin.read()
fin.close()
return res
class PersonRole(models.Model):
personexpedition = models.ForeignKey('PersonExpedition')
person = models.ForeignKey('Person')
survex_block = models.ForeignKey('SurvexBlock')
role = models.ForeignKey('Role')

View File

@ -22,17 +22,19 @@ def expedition(request, expeditionname):
return render_to_response('expedition.html', {'expedition': expedition, 'expedition_next':expedition_next, 'expedition_prev':expedition_prev, 'logbookentries':logbookentries, 'message':message, 'settings': settings})
def person(request, name):
persons = Person.objects.all()
for person in persons:
if person.href() == name:
break
person = None
person = Person.objects.get(href=name)
return render_to_response('person.html', {'person': person, 'settings': settings})
def personexpedition(request, name, expeditionname):
person = Person.objects.get(href=name)
year = int(expeditionname)
expedition = Expedition.objects.get(year=year)
personexpedition = person.personexpedition_set.get(expedition=expedition)
return render_to_response('personexpedition.html', {'personexpedition': personexpedition, 'settings': settings})
def logbookentry(request, logbookentry_id):
logbookentry = LogbookEntry.objects.filter(id = logbookentry_id)[0]
logbookentry = LogbookEntry.objects.filter(href = logbookentry_id)[0]
return render_to_response('logbookentry.html', {'logbookentry': logbookentry, 'settings': settings})

View File

@ -169,10 +169,20 @@ def Parseloghtml01(year, expedition, txt):
triptitles = triptitle.split(" - ")
tripcave = triptitles[0].strip()
ltriptext = re.sub("</p>", "", triptext)
ltriptext = triptext
mtail = re.search('(?:<a href="[^"]*">[^<]*</a>|\s|/|-|&amp;|</?p>|\((?:same day|\d+)\))*$', ltriptext)
if mtail:
#print mtail.group(0)
ltriptext = ltriptext[:mtail.start(0)]
ltriptext = re.sub("</p>", "", ltriptext)
ltriptext = re.sub("\s*?\n\s*", " ", ltriptext)
ltriptext = re.sub("<p>", "\n\n", ltriptext).strip()
ltriptext = re.sub("<p>|<br>", "\n\n", ltriptext).strip()
#ltriptext = re.sub("[^\s0-9a-zA-Z\-.,:;'!]", "NONASCII", ltriptext)
ltriptext = re.sub("</?u>", "_", ltriptext)
ltriptext = re.sub("</?i>", "''", ltriptext)
ltriptext = re.sub("</?b>", "'''", ltriptext)
#print ldate, trippeople.strip()
# could includ the tripid (url link for cross referencing)
@ -246,6 +256,28 @@ def SetDatesFromLogbookEntries(expedition):
expedition.date_to = max([personexpedition.date_to for personexpedition in expedition.personexpedition_set.all() if personexpedition.date_to] or [None])
expedition.save()
# order by appearance in the logbook (done by id)
lprevlogbookentry = None
for logbookentry in expedition.logbookentry_set.order_by('id'):
logbookentry.logbookentry_prev = lprevlogbookentry
if lprevlogbookentry:
lprevlogbookentry.logbookentry_next = logbookentry
lprevlogbookentry.save()
logbookentry.logbookentry_next = None
logbookentry.save()
lprevlogbookentry = logbookentry
# order by date for setting the references
lprevlogbookentry = None
for logbookentry in expedition.logbookentry_set.order_by('date'):
if lprevlogbookentry and lprevlogbookentry.date == logbookentry.date:
mcount = re.search("_(\d+)$", lprevlogbookentry.href)
mc = mcount and (int(mcount.group(1)) + 1) or 1
logbookentry.href = "%s_%d" % (logbookentry.date, mc)
else:
logbookentry.href = "%s" % logbookentry.date
logbookentry.save()
lprevlogbookentry = logbookentry
def LoadLogbookForExpedition(expedition):
@ -268,6 +300,7 @@ def LoadLogbooks():
models.LogbookEntry.objects.all().delete()
expowebbase = os.path.join(settings.EXPOWEB, "years")
#yearlinks = [ ("2001", "2001/log.htm", Parseloghtml01), ] #overwrite
#yearlinks = [ ("1997", "1997/log.htm", Parseloghtml01),] # overwrite
for year, lloc, parsefunc in yearlinks:
expedition = models.Expedition.objects.filter(year = year)[0]

View File

@ -81,8 +81,11 @@ def LoadPersonsExpos():
print firstname, lastname, "NNN", nickname
#assert lastname == person[header[""]], person
href = firstname.lower()
if lastname:
href += "_" + lastname.lower()
pObject = models.Person(first_name = firstname,
last_name = lastname,
last_name = lastname, href=href,
is_vfho = person[header["VfHO member"]],
)

View File

@ -70,7 +70,8 @@ def make_model(name, parent, iter_lines, sf, c, l):
and names.strip("\t").strip(" ") != "Both"])
for name in re.split("&|/|\+|,|;", names):
try:
models.PersonRole(person = exp.GetPersonExpedition(name.strip(" ")).person,
models.PersonRole(personexpedition = exp.GetPersonExpedition(name.strip(" ")),
person = exp.GetPersonExpedition(name.strip(" ")).person,
survex_block = m,
role = models.Role.objects.get(name = roles[role])).save()
except AttributeError:

View File

@ -18,7 +18,7 @@
<tr><th>Caver</th><th>From</th><th>To</th></tr>
{% for personexpedition in expedition.personexpedition_set.all %}
<tr>
<td><a href="{% url person personexpedition.person.href%}">{{personexpedition.person}}</a></td>
<td><a href="{% url personexpedition personexpedition.person.href personexpedition.expedition.year%}">{{personexpedition.person}}</a></td>
<td>{{personexpedition.date_from}}</td>
<td>{{personexpedition.date_to}}</td>
</tr>
@ -36,7 +36,7 @@
{% for logbookentry in logbookentries %}
<tr>
<td>{{logbookentry.date}}</td>
<td><a href="{% url logbookentry logbookentry.id %}">{{logbookentry.title|safe}}</td>
<td><a href="{% url logbookentry logbookentry.href %}">{{logbookentry.title|safe}}</td>
<td><a href="{% url person logbookentry.author.person.href%}">{{logbookentry.author.name}}</a></td>
<td>{{logbookentry.place}}</td>
</tr>

View File

@ -10,12 +10,22 @@
<p><a href="{% url expedition logbookentry.expedition.year %}">{{logbookentry.expedition.name}}</a></p>
<p>place: {{logbookentry.place}}</p>
<p>
{% if logbookentry.logbookentry_prev %}
<a href="{% url logbookentry logbookentry.logbookentry_prev.href %}">{{logbookentry.logbookentry_prev.date}}</a>
{% endif %}
{% if logbookentry.logbookentry_next %}
<a href="{% url logbookentry logbookentry.logbookentry_next.href %}">{{logbookentry.logbookentry_next.date}}</a>
{% endif %}
</p>
<table class="cavers">
<tr><th>Caver</th><th>T/U</th><th>Prev</th><th>Next</th></tr>
{% for persontrip in logbookentry.persontrip_set.all %}
<tr>
{% ifequal persontrip.person_expedition logbookentry.author %}
<td class="author">
{{persontrip.person_expedition.person.personrole_set.count}}
{% else %}
<td>
{% endifequal %}
@ -30,12 +40,12 @@
<td>
{% if persontrip.persontrip_prev %}
<a href="{% url logbookentry persontrip.persontrip_prev.logbook_entry.id %}">{{persontrip.persontrip_prev.date}}</a>
<a href="{% url logbookentry persontrip.persontrip_prev.logbook_entry.href %}">{{persontrip.persontrip_prev.date}}</a>
{% endif %}
</td>
<td>
{% if persontrip.persontrip_next %}
<a href="{% url logbookentry persontrip.persontrip_next.logbook_entry.id %}">{{persontrip.persontrip_next.date}}</a>
<a href="{% url logbookentry persontrip.persontrip_next.logbook_entry.href %}">{{persontrip.persontrip_next.date}}</a>
{% endif %}
</td>
</tr>

View File

@ -0,0 +1,36 @@
{% extends "base.html" %}
{% load wiki_markup %}
{% block title %}Person {{personexpedition.person|wiki_to_html_short}} for {{personexpedition.expedition}}{% endblock %}
{% block content %}
<h2>{{personexpedition.person}}: {{personexpedition.expedition}} ({{personexpedition.date_from}} - {{personexpedition.date_to}})</h2>
<div id="col2">
<table class="survexcontibutions">
<tr><th>Date</th><th>Place</th><th>Role</th></tr>
{% for personrole in personexpedition.personrole_set.all %}
<tr>
<td>{{personrole.survex_block.start_month}}</td>
<td>{{personrole.survex_block.name}}</td>
<td>{{personrole.role}}</td>
</tr>
{% endfor %}
</table>
</div>
<div id="col1">
<table class="expeditionlogbooks">
<tr><th>Date</th><th>Title</th><th>Place</th></tr>
{% for persontrip in personexpedition.persontrip_set.all %}
<tr>
<td>{{persontrip.date}}</td>
<td><a href="{% url logbookentry persontrip.logbook_entry.href %}">{{persontrip.logbook_entry.title|safe}}</td>
<td>{{persontrip.place}}</td>
</tr>
{% endfor %}
</table>
</div>
{% endblock %}

View File

@ -23,10 +23,11 @@ urlpatterns = patterns('',
url(r'^personindex$', personindex, name="personindex"),
url(r'^person/(.+)$', person, name="person"),
url(r'^logbookentry/(\d+)$', logbookentry, name="logbookentry"),
url(r'^logbookentry/(.+)$', logbookentry, name="logbookentry"),
url(r'^logbooksearch/(.*)/?$', logbookSearch),
url(r'^expedition/(\d+)$', expedition, name="expedition"),
url(r'^personexpedition/(.+?)/(\d+)$', personexpedition, name="personexpedition"),
url(r'^statistics/?$', stats, name="stats"),

View File

@ -23,7 +23,7 @@ down cost us a beer however...
<hr />
<a name="start">Steve</a> and <u>Anthony</u> go looking for 161d<br> 1/7/96
<p>1/7/96 | Plateau - go looking for 161d | <a name="start">Steve</a> and <u>Anthony</u> </p>
<p>After sitting around at Top Camp for a bit waiting for the weather to
clear up, it became clear it wasn't going to so we went entrance hunting.
@ -85,7 +85,7 @@ hasn't been checked out - so what the hell is it??
<hr />
1/7/96 <u>Nick</u>, Helen, Gunilla and Matthew go to Expo
1/7/96 | Journey out | <u>Nick</u>, Helen, Gunilla and Matthew
<p>"<i>Buy a car Nick, it'll be lovely</i>" said Steve.<br>
"<i>Buy a car Nick, it'll be really useful and there are this many reasons
@ -111,8 +111,7 @@ G&ouml;sser, so had to join them.
<hr />
<a id="id1996-161-0">3/7/96</a> Anthony, Gunilla, Matthew, <u>Steve</u><br>
Looking for a route to 161d from above
<p><a id="id1996-161-0">3/7/96</a> | Plateau - Looking for a route to 161d from above | Anthony, Gunilla, Matthew, <u>Steve</u></p>
<p>After faffing about in the morning whilst Helen tried to sort out the rest
of her life via Hilde's phone, we set off to top camp about one o'clock. Then
@ -142,8 +141,8 @@ reasonable pace.
<hr />
<u>Helen</u> + Nick<br>
Looking for a way back to England....
<p> | Looking for a way back to England.... | <u>Helen</u> + Nick</p>
<p>As we're nearly ready for going to Top Camp to carry stuff Hilda calls me
and I get a phonecall from Dad "-you have an interview next week". After
@ -201,7 +200,7 @@ Trips same day finding: <a href="#id1996-161-1">Puerile Humour</a> &amp;
<hr />
4/7 <u>Nick</u>, Matthew, Brian, Phil
<p>4/7 | Carry up | <u>Nick</u>, Matthew, Brian, Phil</p>
Carried lots of shit up to Top Camp in the heat, whilst Steve and Anthony
massacred some bunde with Anthony's Junior Hacksaw. Saw a little adder
@ -209,7 +208,7 @@ massacred some bunde with Anthony's Junior Hacksaw. Saw a little adder
<hr />
*2/7 Brian &amp; <u>PhilU</u>
<p>2/7 | Journey out | Brian &amp; <u>PhilU</u></p>
<p>Set of from London 3:30am. Folkestone. Chunnel. France. Belgium. Germany.
Fly-camp. More Germany. Austria. Base Camp. Top Camp. 50mph. 'Nuff said.
@ -219,7 +218,7 @@ ADVENTURE
<hr />
<a id="id1996-161-1">5/7</a> Matthew, <u>PhilU</u>, Steve
<p><a id="id1996-161-1">5/7</a> | Walk up |Matthew, <u>PhilU</u>, Steve</p>
<p>We walked from Top Camp to Scarface. It was a bastard. Got changed and
sweated whilst waiting for everyone else. Entered cave and trundled along to
@ -239,8 +238,8 @@ Trips same day finding: <a href="#id1996-161-3">Interview Blues</a> &amp;
<hr />
<a id="id1996-161-4">6/7</a> <u>Nick</u> Anthony Brian
Pushing Leads off Trifurcation
<p><a id="id1996-161-4">6/7</a> | Pushing Leads off Trifurcation | <u>Nick</u> Anthony Brian</p>
<p>(or Silly Bastards go caving in the rain) The caving was lovely, the walk
in (55mins) and the walk out (45mins) were done in the pissing rain. Had we
@ -268,8 +267,8 @@ This can only be reached by a very airy traverse - a job for the drill.
<hr />
<a id="id1996-161-2"></a><u>Brian</u> &amp; Anthony's caving bit:
<p>5/7 Pushing 95-54 near MINOAN surprise. Placed back up bolt to left of
<p>5/7 | minoan surprise |<a id="id1996-161-2"></a><u>Brian</u> &amp; Anthony
Pushing 95-54 near MINOAN surprise. Placed back up bolt to left of
pitch head. Found Stubai Al. crab - last years ? Placed another bolt at pitch
head, descended 10m placed rebelay bolt went down to next ledge 7m down
couldn't see bottom so tied off rope bag &amp; exited cave<br>
@ -283,7 +282,9 @@ Trips same day finding: <a href="#id1996-161-1">Puerile Humour</a> &amp;
<hr />
<p><a id="id1996-161-4a">6/7</a> Got down to 10m rebelay descended 7m placed
<p><a id="id1996-161-4a">6/7</a> | caver | unknown</p>
Got down to 10m rebelay descended 7m placed
another rebelay just below ledge then 60m freehang with deviation off sharp
flake on right about 35m down giving nice freehang descent to land on boulder
slope at bottom to left is ascending rift up small streamway - not pushed -
@ -302,7 +303,8 @@ TU 5 &frac12; hrs
<hr />
PhilB &amp; Ralph's amazing journey!
<p>unknown | Journey out | PhilB &amp; Ralph </p>
<p>Planning? Who needs it! I 'phoned Ralph on Wednesday to make arrangements
i.e. to meet at Julian's house on Saturday afternoon; Midday Saturday, I
@ -324,7 +326,7 @@ more credit to the car for never faltering (thanks, Pete!)
<hr />
9/7/96 Nick, Brian, PhilU &amp; <u>Anthony</u> attempt to go caving
<p>9/7/96 | attempt to go caving | Nick, Brian, PhilU &amp; <u>Anthony</u> </p>
<p>After two day's festering with 11 belching farting cavers in the potato
hut, team keen decided to earn some super hero points by going caving in
@ -351,8 +353,7 @@ trip (I hope)]
<hr />
5/7/96 <u>Dunks</u>, paul &amp; Jen drive across europe (<u>not</u> via
Frankfurt)
<p>5/7/96 | Journey out - not via Frankfurt | <u>Dunks</u>, paul &amp; Jen </p>
<p>Quite a straightforward journey really, except for there seems to have
been some sort of communication fuck-up concerning the route.
@ -374,7 +375,7 @@ have to remove the headlights. In turn, to get to the clips holding the
headlight in place, you have to remove the radiator grille...
<p>Things weren't helped by someone having done a bodge at some stage with
one of the retaining clips for the headlight making the *#£!!ng thing damn
one of the retaining clips for the headlight making the *#<EFBFBD>!!ng thing damn
near impossible to put back in place.
<p>Eventually fettled it all. Checked everything was working and set off.
@ -383,8 +384,7 @@ that then...
<hr />
<a id="id1996-161-5">11/7/96</a> Brian, Nick and <u>Anthony</u> - Surveying
big pitch off Minoan Surprise (QM 95-54)
<p><a id="id1996-161-5">11/7/96</a> | Surveying big pitch off Minoan Surprise (QM 95-54) | Brian, Nick and <u>Anthony</u></p>
<p>Finally went caving after 4 days of inaction. First laid some string along
the route through Triassic Park - v tedious. Someone else can do the rest.
@ -418,7 +418,7 @@ Those waiting at the bottom were most relieved to see the return of the rope.
<hr />
12/7/96 Andrew, Andrew, Juliete + <u>Dave</u>
<p>12/7/96 | Journey out | Andrew, Andrew, Juliete + <u>Dave</u></p>
<p>It was awful. Austria was too near so we thought we (A+D) would empty
Andrew's house to Southampton to make it take longer. So, we bought a tow
@ -488,8 +488,7 @@ Staud'n'wirt and YOU'VE ALL SODDED OFF!
<hr />
<u>Trouble free motoring by J.Todd</u><br>
<center>&amp; Wookey in the badvan</center>
<p>unknown | Journey Out - Trouble free motoring in the badvan | <u>Julian Todd</u>, Wookey</p>
<p>The bad van struck again. I negotiated a subsidy from NC Graphics UK Ltd.
to carry a Pentium Pro to NC Graphics Deutschland near Munich instead of
@ -520,8 +519,7 @@ up the perch pass in 1st gear got us to an empty campsite.
<hr />
<a id="id1996-161-6">11/7/96</a> Ralph, Steve, <u>Matthew</u>
<br><center>Pushing Puerile Humour</center>
<p><a id="id1996-161-6">11/7/96</a> | 161 - Pushing Puerile Humour | Ralph, Steve, <u>Matthew</u></p>
<p>The finds extending N from nr. Ringpiece Junction, having fallen victim to
a G&ouml;ssered-up naming session by Steve, have become the Puerile Humour
@ -546,8 +544,7 @@ pushing got done - Raining outside.
<hr />
<a id="id1996-161-12">14/7/96</a> <u>Lumatt</u> + Ralph
<br><center>Puerile Humour</center>
<p><a id="id1996-161-12">14/7/96</a> | 161 - Puerile Humour | <u>Lumatt</u> + Ralph</p>
<p>Excellent stroll to this series. Pitch '(20m?)' descended 7m on 2 naturals
across traverse (<u>N</u>ATURALS <u>C</u>ITY 1) 3m to top of NC2. On left at

View File

@ -302,7 +302,6 @@ strong cold draft.
circular entrance with mud floor, leads to a 3m deep pot which is blind.
The way on over the top of the pot soon chokes - no draft.
<p><u>Dave</u>
<hr />
@ -396,12 +395,10 @@ close to our call-out time of 8pm.
<p>T/U 7 &frac34; hours
<p><center>Dave</center>
<p><a href="#id1997-161-8">Previous trip</a> /
<a href="#id1997-161-10">The surveying trip</a>
<a href="#id1997-161-12">Next trip</a> /
<a href="#id1997-136-1">136 trip</a> &amp;
<a href="#id1997-136-1">136 trip</a>
<a href="#id1997-161-11">Siberia trip</a> (same day)
<hr />
@ -613,8 +610,6 @@ Perseverance and Slidy Caver again. Got out with weather still OK, but heavy
cloud building. Back to camp OK, but it started thundering, lightening and
pissing down on the way down.
<p><center>Dave</center>
<p><a href="#id1997-161-14a">Previous trip</a> (Where The Wind Blows) /
Next trip - 1999 ?
@ -922,7 +917,7 @@ Team up as we pigged out on tortellini again. A fine trip on a dreary day -
KH over 500m + a new entrance!!!
<p><a href="#id1997-136-4">Previous trip</a> /
Next trips (into 161): <a href="#id1997-136-6">Forbidden Land</a> &amp;
<a href="#id1997-136-6">Forbidden Land</a> &amp;
<a href="#id1997-136-7">Gravel Pit</a> /
<a href="#id1997-136-8">Next 136 push</a>
@ -1038,7 +1033,7 @@ pitch with wind farting up it.
<p><a href="#id1997-161-16">Previous trip</a> /
<a href="#id1997-161-22">Next SEP trip</a> /
<a href="#id1997-161-20">Next Siberia trip</a> (Fuzzy Logic)
<a href="#id1997-161-20">Next Siberia trip</a>
<hr />
@ -1078,10 +1073,9 @@ in Triassic. The two holes connect, lead to a 1.5m climb down to the
head of a pitch. Unfortunately, this just drops into Wheelchair Access,
and needs surveying.
<p><center>Dave</center>
<p><a href="#id1997-161-25">Next Moomintroll trip</a> /
Other trips (same day): <a href="#id1997-136-6">136 Forbidden Land</a> /
<a href="#id1997-136-6">136 Forbidden Land</a> /
<a href="#id1997-136-7">136 Gravel Pit</a> / <a href="#id1997-161-17">Siberia</a>
<hr />