summaryrefslogtreecommitdiffstats
path: root/core/views/logbooks.py
diff options
context:
space:
mode:
Diffstat (limited to 'core/views/logbooks.py')
-rw-r--r--core/views/logbooks.py29
1 files changed, 10 insertions, 19 deletions
diff --git a/core/views/logbooks.py b/core/views/logbooks.py
index 9508877..00ac4e4 100644
--- a/core/views/logbooks.py
+++ b/core/views/logbooks.py
@@ -12,8 +12,7 @@ from django.template.defaultfilters import slugify
from django.utils import timezone
from django.views.generic.list import ListView
-#import troggle.parsers.logbooks as logbookparsers
-from troggle.core.forms import getTripForm # , get_name, PersonForm
+from troggle.core.forms import getTripForm # , get_name
from troggle.core.models.troggle import Expedition, Person, PersonExpedition
from troggle.core.utils import TROG
from troggle.core.models.caves import LogbookEntry, PersonTrip
@@ -30,29 +29,21 @@ and for persons: their individual pages and their perseonexpedition pages.
It uses the global object TROG to hold some cached pages.
'''
-def getNotablePersons():
- notablepersons = []
- for person in Person.objects.all():
- if person.bisnotable():
- notablepersons.append(person)
- return notablepersons
-
-
def personindex(request):
persons = Person.objects.all()
- # From what I can tell, "persons" seems to be the table rows, while "personss" is the table columns. - AC 16 Feb 09
- personss = [ ]
+ # From what I can tell, "persons" seems to be the table rows, while "pcols" is the table columns. - AC 16 Feb 09
+ pcols = [ ]
ncols = 4
nc = int((len(persons) + ncols - 1) / ncols)
for i in range(ncols):
- personss.append(persons[i * nc: (i + 1) * nc])
+ pcols.append(persons[i * nc: (i + 1) * nc])
notablepersons = []
for person in Person.objects.all():
if person.bisnotable():
notablepersons.append(person)
- return render(request,'personindex.html', {'persons': persons, 'personss':personss, 'notablepersons':notablepersons})
+ return render(request,'personindex.html', {'persons': persons, 'pcols':pcols, 'notablepersons':notablepersons})
def expedition(request, expeditionname):
@@ -65,7 +56,7 @@ def expedition(request, expeditionname):
'''
if "reload" in request.GET:
this_expedition = Expedition.objects.get(year=int(expeditionname))
- LoadLogbookForExpedition(this_expedition, 0)
+ LoadLogbookForExpedition(this_expedition, 0) # 0 means re-parse
ts = TROG['pagecache']['expedition']
if settings.CACHEDPAGES:
@@ -101,8 +92,8 @@ def expedition(request, expeditionname):
return render(request,'expedition.html', ts[expeditionname] )
-def get_absolute_url(self):
- return ('expedition', (expedition.year))
+# def get_absolute_url(self): # seems to have come seriously adrift. This should be in a class?!
+ # return ('expedition', (expedition.year))
class Expeditions_tsvListView(ListView):
@@ -136,7 +127,7 @@ def person(request, first_name='', last_name='', ):
return render(request,'person.html', {'person': this_person, })
-def GetPersonChronology(personexpedition):
+def get_person_chronology(personexpedition):
'''Horrible bug here whern there is more than one survex block per day, it duplicates the entry but gets it wrong
Fortunately this is just the display on this page which is wroing, no bad calculations get into the database.
'''
@@ -166,7 +157,7 @@ def personexpedition(request, first_name='', last_name='', year=''):
person = Person.objects.get(first_name = first_name, last_name = last_name)
this_expedition = Expedition.objects.get(year=year)
personexpedition = person.personexpedition_set.get(expedition=this_expedition)
- personchronology = GetPersonChronology(personexpedition)
+ personchronology = get_person_chronology(personexpedition)
return render(request,'personexpedition.html', {'personexpedition': personexpedition, 'personchronology':personchronology})