summaryrefslogtreecommitdiffstats
path: root/expo
diff options
context:
space:
mode:
authorsubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-05-13 06:02:42 +0100
committersubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-05-13 06:02:42 +0100
commit91e4f0f8c0f4daa8434d21e2a0240718e4000187 (patch)
tree15cb22d117f89539c4fec54b38eaca56bcbbd215 /expo
parent64000dda37ed3595603fc724a7653816516f65a7 (diff)
downloadtroggle-91e4f0f8c0f4daa8434d21e2a0240718e4000187.tar.gz
troggle-91e4f0f8c0f4daa8434d21e2a0240718e4000187.tar.bz2
troggle-91e4f0f8c0f4daa8434d21e2a0240718e4000187.zip
[svn] Reverted the reverts from 8267. Fixed the next / previous trip in personexpedition on the LogbookEntry template -- I had misunderstood what this was supposed to do last time I messed with it. This involved adding the methods PersonTrip.get_persons_next_trip and persons_previous_trip. Couldn't find any other broken things.
Kept the productive changes in 8267: extending the logbook parsing back to 1993, changing index page, changes to view_surveys.py Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8274 by aaron @ 3/14/2009 8:38 AM
Diffstat (limited to 'expo')
-rw-r--r--expo/models.py12
-rw-r--r--expo/views_logbooks.py4
-rw-r--r--expo/views_other.py3
3 files changed, 15 insertions, 4 deletions
diff --git a/expo/models.py b/expo/models.py
index 395f973..6b94dde 100644
--- a/expo/models.py
+++ b/expo/models.py
@@ -260,7 +260,19 @@ class PersonTrip(TroggleModel):
def __unicode__(self):
return "%s %s (%s)" % (self.person_expedition, self.place, self.date)
+ def get_persons_next_trip(self):
+ try:
+ return PersonTrip.objects.filter(person_expedition__person=self.person_expedition.person, date__gt=self.date)[0]
+ except:
+ return
+
+ def get_persons_previous_trip(self):
+ try:
+ return PersonTrip.objects.filter(person_expedition__person=self.person_expedition.person, date__lt=self.date)[0]
+ except:
+ return
+# def get_persons_previous_trip(self):
#
# move following classes into models_cave
#
diff --git a/expo/views_logbooks.py b/expo/views_logbooks.py
index ab85318..fae7491 100644
--- a/expo/views_logbooks.py
+++ b/expo/views_logbooks.py
@@ -63,8 +63,8 @@ def person(request, first_name='', last_name=''):
# person = Person.objects.get(href=name)
#
-def personexpedition(request, href, year):
- person = Person.objects.get(href=href)
+def personexpedition(request, first_name='', last_name='', year=''):
+ person = Person.objects.get(first_name = first_name, last_name = last_name)
expedition = Expedition.objects.get(year=year)
personexpedition = person.personexpedition_set.get(expedition=expedition)
return render_response(request,'personexpedition.html', {'personexpedition': personexpedition, })
diff --git a/expo/views_other.py b/expo/views_other.py
index 9852ccc..d890a6e 100644
--- a/expo/views_other.py
+++ b/expo/views_other.py
@@ -29,8 +29,7 @@ def frontpage(request):
#'randSent':randSent.randomLogbookSentence(),
expeditions = Expedition.objects.order_by("-year")
- totallogbookentries = LogbookEntry.objects.count()
- return render_response(request,'index.html', {'expeditions':expeditions, 'all':'all', 'totallogbookentries':totallogbookentries, "message":message})
+ return render_response(request,'index.html', {'expeditions':expeditions, 'all':'all', "message":message})
def calendar(request,year):
week=['S','S','M','T','W','T','F']