2009-05-13 05:22:14 +01:00
|
|
|
from django.shortcuts import render_to_response
|
2009-05-13 05:35:11 +01:00
|
|
|
from troggle.expo.models import Cave, Expedition, Person, LogbookEntry, PersonExpedition
|
2009-05-13 05:22:14 +01:00
|
|
|
import troggle.settings as settings
|
|
|
|
from django import forms
|
|
|
|
from django.db.models import Q
|
2009-05-13 05:35:59 +01:00
|
|
|
from troggle.parsers.people import LoadPersonsExpos
|
2009-05-13 05:25:17 +01:00
|
|
|
import re
|
2009-05-13 05:39:52 +01:00
|
|
|
from troggle.parsers.survex import LoadAllSurvexBlocks
|
2009-05-13 05:31:44 +01:00
|
|
|
import randSent
|
2009-05-13 05:22:14 +01:00
|
|
|
|
2009-05-13 05:35:59 +01:00
|
|
|
from django.core.urlresolvers import reverse
|
|
|
|
|
2009-05-13 05:22:14 +01:00
|
|
|
def stats(request):
|
|
|
|
statsDict={}
|
|
|
|
statsDict['expoCount'] = int(Expedition.objects.count())
|
|
|
|
statsDict['caveCount'] = int(Cave.objects.count())
|
|
|
|
statsDict['personCount'] = int(Person.objects.count())
|
|
|
|
statsDict['logbookEntryCount'] = int(LogbookEntry.objects.count())
|
2009-05-13 05:25:17 +01:00
|
|
|
return render_to_response('statistics.html', statsDict)
|
|
|
|
|
2009-05-13 05:31:44 +01:00
|
|
|
def frontPage(request):
|
2009-05-13 05:35:59 +01:00
|
|
|
message = "no test message" #reverse('personn', kwargs={"name":"hkjhjh"})
|
2009-05-13 05:39:52 +01:00
|
|
|
if "reloadexpos" in request.GET:
|
2009-05-13 05:35:59 +01:00
|
|
|
message = LoadPersonsExpos()
|
|
|
|
message = "Reloaded personexpos"
|
2009-05-13 05:39:52 +01:00
|
|
|
if "reloadsurvex" in request.GET:
|
|
|
|
message = LoadAllSurvexBlocks()
|
|
|
|
message = "Reloaded survexblocks"
|
|
|
|
|
2009-05-13 05:35:59 +01:00
|
|
|
#'randSent':randSent.randomLogbookSentence(),
|
2009-05-13 05:44:35 +01:00
|
|
|
expeditions = Expedition.objects.order_by("-year")
|
2009-05-13 05:45:01 +01:00
|
|
|
return render_to_response('index.html', {'expeditions':expeditions, 'settings':settings, 'all':'all', "message":message})
|
2009-05-13 05:35:11 +01:00
|
|
|
|
|
|
|
def calendar(request,year):
|
|
|
|
week=['S','S','M','T','W','T','F']
|
|
|
|
if year:
|
|
|
|
expedition=Expedition.objects.get(year=year)
|
|
|
|
PersonExpeditions=expedition.personexpedition_set.all()
|
|
|
|
|
|
|
|
dictToPass=locals()
|
|
|
|
dictToPass.update({'settings':settings})
|
|
|
|
return render_to_response('calendar.html', dictToPass)
|