[svn] made index of people

Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8224 by julian @ 1/24/2009 6:26 PM
This commit is contained in:
substantialnoninfringinguser 2009-05-13 05:44:35 +01:00
parent 1e1453f443
commit 264594ed05
10 changed files with 61 additions and 53 deletions

View File

@ -19,6 +19,9 @@ class Expedition(models.Model):
def __unicode__(self):
return self.year
class Meta:
ordering = ('year',)
def GuessDateFrom(self):
try:
return self.logbookentry_set.order_by('date')[0].date
@ -71,12 +74,20 @@ class Person(models.Model):
class Meta:
verbose_name_plural = "People"
class Meta:
ordering = ('last_name', 'first_name')
def __unicode__(self):
if self.last_name:
return "%s %s" % (self.first_name, self.last_name)
return self.first_name
# these ought to be possible by piping through |min in the template, or getting the first of an ordered list
def Firstexpedition(self):
return self.personexpedition_set.order_by('expedition')[0]
def Lastexpedition(self):
return self.personexpedition_set.order_by('-expedition')[0]
class PersonExpedition(models.Model):
expedition = models.ForeignKey(Expedition)
@ -96,6 +107,9 @@ class PersonExpedition(models.Model):
print res
return res
class Meta:
ordering = ('expedition',)
def GetPersonChronology(self):
res = { }
for persontrip in self.persontrip_set.all():

View File

@ -10,7 +10,13 @@ import re
def personindex(request):
persons = Person.objects.all()
return render_to_response('personindex.html', {'persons': persons, 'settings': settings})
personss = [ ]
ncols = 5
nc = (len(persons) + ncols - 1) / ncols
for i in range(ncols):
personss.append(persons[i * nc: (i + 1) * nc])
return render_to_response('personindex.html', {'persons': persons, 'personss':personss, 'settings': settings})
def expedition(request, expeditionname):
year = int(expeditionname)

View File

@ -28,7 +28,7 @@ def frontPage(request):
message = "Reloaded survexblocks"
#'randSent':randSent.randomLogbookSentence(),
expeditions = Expedition.objects.all()
expeditions = Expedition.objects.order_by("-year")
return render_to_response('index.html', {'expeditions':expeditions, 'settings':settings, "message":message})
def calendar(request,year):

View File

@ -129,7 +129,7 @@ table.expeditionlogbooks td
ul#expeditionlist
{
width: 300px
width: 800px
}
div.survexblock

View File

@ -91,7 +91,7 @@ def LoadPersonsExpos():
is_guest = person[header["Guest"]] == "1" # this is really a per-expo catagory; not a permanent state
pObject.save()
parseMugShotAndBlurb(firstname, lastname, person, header, pObject)
#parseMugShotAndBlurb(firstname, lastname, person, header, pObject)
for year, attended in zip(headers, person)[5:]:
yo = models.Expedition.objects.filter(year = year)[0]
@ -111,11 +111,18 @@ def LoadPersonsExpos():
firstname, lastname = name.split()
is_guest = name in ["Eeva Makiranta", "Keith Curtis"]
print "2008:", name
pObject = models.Person(first_name = firstname,
last_name = lastname,
is_vfho = False,
mug_shot = "")
pObject.save()
persons = list(models.Person.objects.filter(first_name=firstname, last_name=lastname))
if not persons:
pObject = models.Person(first_name = firstname,
last_name = lastname,
is_vfho = False,
mug_shot = "")
pObject.href = firstname.lower()
if lastname:
pObject.href += "_" + lastname.lower()
pObject.save()
else:
pObject = persons[0]
yo = models.Expedition.objects.filter(year = "2008")[0]
pyo = models.PersonExpedition(person = pObject, expedition = yo, nickname="", is_guest=is_guest)
pyo.save()

View File

@ -15,10 +15,7 @@
<div style="float:none">
<div id="expoHeader" style="background:#222"> <img src="{{ settings.MEDIA_URL }}loserBanner.jpg" style="position:relative;width:inherit;height:inherit;"/>
<div id="expoHeaderText">
<h1>CUCC Expeditions to Austria: 1976 - </h1>
<div id="expoFinalDate" style="display:inline;" >
<h1>1976</h1>
</div>
<h1>CUCC Expeditions to Austria: 1976 - 2008</h1>
</div>
</div>
<hr/>

View File

@ -27,8 +27,8 @@
<h3>{{message}}</h3>
<ul>
<li><a href="{% url caveindex %}">List of Caves</a></li>
<li><a href="{% url personindex %}">List of People</a></li>
<li><a href="{% url caveindex %}">List of Caves</a></li>
<li><a href="/statistics">Statistics of what's loaded in the database</a></li>
<li><a href="{% url survexindex survex_file=all %}">Survex directory</a></li>
<li><a href="{% url survey %}">Survey files</a></li>

View File

@ -4,25 +4,13 @@
{% block title %}Person {{person|wiki_to_html_short}}{% endblock %}
{% block content %}
<div class="personblock"><a href="{% url person person.href%}">{{person|wiki_to_html_short}}</a>
<ul>
<p>{{person|wiki_to_html_short}} has been on expo in the following years:</p>
<p>
{% for personexpedition in person.personexpedition_set.all %}
<li>
<table><tr><td>
{{personexpedition.expedition}}
</td><td>
<div>
<ul>
{% for persontrip in personexpedition.persontrip_set.all %}
<li><a href="{% url logbookentry persontrip.logbook_entry.id %}">{{persontrip.date}}</a> {{persontrip.logbookentry}}
({{persontrip.logbookentry.place|wiki_to_html_short}}) -
{{persontrip.logbookentry.title|wiki_to_html_short}}</li>
{% endfor %}
<ul>
</div>
</td></tr></table>
</li>
| <a href="{% url personexpedition personexpedition.person.href personexpedition.expedition.year %}">{{personexpedition.expedition.year}}</a>
{% endfor %}
</ul>
</div>
</p>
{% endblock %}

View File

@ -10,6 +10,7 @@
<h3>{{message}}</h3>
<p><b><a href="{% url expedition personexpedition.expedition.year %}">Main page for expedition: {{personexpedition.expedition}}</a></b></p>
<p><b><a href="{% url person personexpedition.person.href %}">Main page for person: {{personexpedition.person}}</a></b></p>
<p>List of other expos by this person</p>
<p>

View File

@ -5,28 +5,23 @@
{% block content %}
<table>
<tr>
{% for persons in personss %}
<td>
<table>
<tr><th>Person</th><th>First</th><th>Last</th></tr>
{% for person in persons %}
<div class="personblock"><a href="{% url person person.href%}">{{person|wiki_to_html_short}}</a>
<ul>
{% for personexpedition in person.personexpedition_set.all %}
<li>
<table><tr><td>
{{personexpedition.expedition}}
</td><td>
<div>
{% for persontrip in personexpedition.persontrip_set.all %}
<a href="{% url logbookentry persontrip.logbook_entry.id %}">{{persontrip.date}}</a>
{% endfor %}
</div>
</td></tr></table>
</li>
<tr>
<td><a href="{% url person person.href%}">{{person|wiki_to_html_short}}</a></td>
<td><a href="{% url personexpedition person.href person.Firstexpedition.expedition.year %}">{{person.Firstexpedition.expedition.year}}</a></td>
<td><a href="{% url personexpedition person.href person.Lastexpedition.expedition.year %}">{{person.Lastexpedition.expedition.year}}</a></td>
</tr>
{% endfor %}
</ul>
</div>
</table>
</td>
{% endfor %}
</tr>
</table>
{% endblock %}