From 6776111c6e858ff0931270d5641bc2ab4d53daa9 Mon Sep 17 00:00:00 2001 From: aaron Date: Mon, 16 Feb 2009 09:31:26 +0100 Subject: [PATCH] [svn r8244] My crusade to make our project more Djangoic. Got rid of the url tags in template, replaced them with get_absolute_url method calls where possible. Adding get_absolute_url in models enables direct link to the public model views in admin. The use of get_absolute_url, which is the correct Django way of doing things, eliminates any need for the redundant "href" fields we were using. Those fields now need to be deleted from the models and from the parsers. Made the context processor to pass settings to all templates actually work, although this was a little uglier than expected. I had to put in a new render_response to replace render_to_response. This is because Django uses Context, not RequestContext by default. I wish they would change this, it's annoying. Anyway, I deleted all the manual settings passing in the views. I also eliminated a couple of unnecessary methods and stuff like that. --- troggle/context.py | 7 -- troggle/expo/admin.py | 6 +- troggle/expo/context.py | 4 + troggle/expo/models.py | 60 ++++++++++---- troggle/expo/views.py | 1 + troggle/expo/views_caves.py | 41 +++++----- troggle/expo/views_logbooks.py | 40 +++++---- troggle/expo/views_other.py | 10 +-- troggle/parsers/people.py | 2 +- troggle/parsers/surveys.py | 35 ++++---- troggle/settings.py | 2 +- troggle/templates/calendar.html | 15 +++- troggle/templates/cave.html | 2 +- troggle/templates/caveindex.html | 4 +- troggle/templates/expedition.html | 104 ++++++++++++------------ troggle/templates/logbookentry.html | 15 ++-- troggle/templates/person.html | 2 +- troggle/templates/personexpedition.html | 10 +-- troggle/templates/personindex.html | 12 +-- troggle/templates/survey.html | 14 ++-- troggle/urls.py | 10 ++- 21 files changed, 220 insertions(+), 176 deletions(-) delete mode 100644 troggle/context.py create mode 100644 troggle/expo/context.py diff --git a/troggle/context.py b/troggle/context.py deleted file mode 100644 index 9afc33e4d..000000000 --- a/troggle/context.py +++ /dev/null @@ -1,7 +0,0 @@ -import troggle.settings as settings - -def settingsContext(request): - return { 'settings.MEDIA_URL':settings.MEDIA_URL, - 'settings.URL_ROOT':settings.URL_ROOT, - 'settings.ADMIN_MEDIA_PREFIX':settings.ADMIN_MEDIA_PREFIX, - 'settings.SVX_URL':settings.SVX_URL } \ No newline at end of file diff --git a/troggle/expo/admin.py b/troggle/expo/admin.py index d5a7ddd6c..afad1ffb5 100644 --- a/troggle/expo/admin.py +++ b/troggle/expo/admin.py @@ -29,8 +29,12 @@ class PersonAdmin(admin.ModelAdmin): class PersonExpeditionAdmin(admin.ModelAdmin): search_fields = ('person__first_name','expedition__year') +class CaveAdmin(admin.ModelAdmin): + search_fields = ('official_name','kataster_number','unofficial_number') + extra = 4 + admin.site.register(Photo) -admin.site.register(Cave) +admin.site.register(Cave, CaveAdmin) admin.site.register(Area) admin.site.register(OtherCaveName) admin.site.register(CaveAndEntrance) diff --git a/troggle/expo/context.py b/troggle/expo/context.py new file mode 100644 index 000000000..06215cea0 --- /dev/null +++ b/troggle/expo/context.py @@ -0,0 +1,4 @@ +from django.conf import settings + +def settings_context(request): + return { 'settings':settings } \ No newline at end of file diff --git a/troggle/expo/models.py b/troggle/expo/models.py index aa84110e3..bbe052cd4 100644 --- a/troggle/expo/models.py +++ b/troggle/expo/models.py @@ -22,6 +22,10 @@ class Expedition(models.Model): class Meta: ordering = ('year',) + get_latest_by = 'date_from' + + def get_absolute_url(self): + return settings.URL_ROOT + "/expedition/%s" % self.year # lose these two functions (inelegant, and we may create a file with the dates that we can load from) def GuessDateFrom(self): @@ -62,11 +66,13 @@ class Person(models.Model): blurb = models.TextField(blank=True,null=True) href = models.CharField(max_length=200) - orderref = models.CharField(max_length=200) # for alphabetic + orderref = models.CharField(max_length=200) # for alphabetic notability = models.FloatField() # for listing the top 20 people bisnotable = models.BooleanField() user = models.ForeignKey(User, unique=True, null=True, blank=True) - + def get_absolute_url(self): + return settings.URL_ROOT + "/person/%s_%s/" % (self.first_name, self.last_name) + class Meta: verbose_name_plural = "People" class Meta: @@ -76,12 +82,13 @@ class Person(models.Model): if self.last_name: return "%s %s" % (self.first_name, self.last_name) return self.first_name - + +# Below are no longer needed. Use {{ person.personexpedition_set.all.0.expedition }} for Firstexpedition, and {{ person.personexpedition_set.latest.expedition }} for Lastexpedition # 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] +# def Firstexpedition(self): +# return self.personexpedition_set.order_by('expedition')[0] +# def Lastexpedition(self): +# return self.personexpedition_set.order_by('-expedition')[0] def Sethref(self): if self.last_name: @@ -99,6 +106,14 @@ class PersonExpedition(models.Model): date_from = models.DateField(blank=True,null=True) date_to = models.DateField(blank=True,null=True) is_guest = models.BooleanField(default=False) + COMMITTEE_CHOICES = ( + ('leader','Expo leader'), + ('medical','Expo medical officer'), + ('treasurer','Expo treasurer'), + ('sponsorship','Expo sponsorship coordinator'), + ('research','Expo research coordinator'), + ) + expo_committee_position = models.CharField(blank=True,null=True,choices=COMMITTEE_CHOICES,max_length=200) nickname = models.CharField(max_length=100,blank=True,null=True) def GetPersonroles(self): @@ -112,6 +127,7 @@ class PersonExpedition(models.Model): class Meta: ordering = ('expedition',) + get_latest_by = 'date_from' def GetPersonChronology(self): res = { } @@ -130,8 +146,8 @@ class PersonExpedition(models.Model): # needs converting dict into list return sorted(res.items()) - # don't use tabs. - # possibly not useful functions anyway + # possibly not useful functions anyway -JT + # if you can find a better way to make the expo calendar table, be my guest. It isn't possible to do this logic in a django template without writing custom tags. def ListDays(self): if self.date_from and self.date_to: res=[] @@ -151,6 +167,7 @@ class PersonExpedition(models.Model): def __unicode__(self): return "%s: (%s)" % (self.person, self.expedition) + #why is the below a function in personexpedition, rather than in person? - AC 14 Feb 09 def name(self): if self.nickname: return "%s (%s) %s" % (self.person.first_name, self.nickname, self.person.last_name) @@ -158,6 +175,8 @@ class PersonExpedition(models.Model): return "%s %s" % (self.person.first_name, self.person.last_name) return self.person.first_name + def get_absolute_url(self): + return settings.URL_ROOT + '/personexpedition/' + str(self.person.first_name) + '_' + str(self.person.last_name) + '/' +self.expedition.year class LogbookEntry(models.Model): date = models.DateField() @@ -167,22 +186,26 @@ class LogbookEntry(models.Model): 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) + #href = models.CharField(max_length=100) - # turn these into functions - logbookentry_next = models.ForeignKey('LogbookEntry', related_name='pnext', blank=True,null=True) - logbookentry_prev = models.ForeignKey('LogbookEntry', related_name='pprev', blank=True,null=True) + #logbookentry_next = models.ForeignKey('LogbookEntry', related_name='pnext', blank=True,null=True) + #logbookentry_prev = models.ForeignKey('LogbookEntry', related_name='pprev', blank=True,null=True) + class Meta: verbose_name_plural = "Logbook Entries" # several PersonTrips point in to this object class Meta: ordering = ('-date',) - + + def get_absolute_url(self): + return settings.URL_ROOT + "/logbookentry/" + str(self.pk) + def __unicode__(self): return "%s: (%s)" % (self.date, self.title) + class PersonTrip(models.Model): person_expedition = models.ForeignKey(PersonExpedition) @@ -252,13 +275,14 @@ class Cave(models.Model): href = models.CharField(max_length=100) - def Sethref(self): + def get_absolute_url(self): if self.kataster_number: - self.href = self.kataster_number + href = self.kataster_number elif self.unofficial_number: - self.href = self.unofficial_number + href = self.unofficial_number else: - self.href = official_name.lower() + href = official_name.lower() + return settings.URL_ROOT + '/cave/' + self.href + '/' def __unicode__(self): diff --git a/troggle/expo/views.py b/troggle/expo/views.py index 4183f6894..337989a92 100644 --- a/troggle/expo/views.py +++ b/troggle/expo/views.py @@ -1,4 +1,5 @@ # primary namespace + import view_surveys import views_caves import views_survex diff --git a/troggle/expo/views_caves.py b/troggle/expo/views_caves.py index 684f4b498..f2ddad8da 100644 --- a/troggle/expo/views_caves.py +++ b/troggle/expo/views_caves.py @@ -1,57 +1,57 @@ -from django.shortcuts import render_to_response from troggle.expo.models import Cave, CaveAndEntrance, Survey, Expedition import troggle.expo.models as models import troggle.settings as settings from troggle.expo.forms import CaveForm import search +from troggle.alwaysUseRequestContext import render_response # see views_logbooks for explanation on this. def caveindex(request): caves = Cave.objects.all() notablecavehrefs = [ "161", "204", "258", "76" ] # could detect notability by trips and notability of people who have been down them notablecaves = [ Cave.objects.get(href=href) for href in notablecavehrefs ] - return render_to_response('caveindex.html', {'caves': caves, 'notablecaves':notablecaves, 'settings': settings}) + return render_response(request,'caveindex.html', {'caves': caves, 'notablecaves':notablecaves}) -def cavehref(request, href): - cave = Cave.objects.get(href=href) - return render_to_response('cave.html', {'cave': cave, 'settings': settings}) +def cavehref(request, cave_id='', offical_name=''): + try: + cave = Cave.objects.get(kataster_number=cave_id) + except DoesNotExist: + cave = Cave.objects.get(unofficial_number=cave_id) + return render_response(request,'cave.html', {'cave': cave,}) def ent(request, cave_id, ent_letter): cave = Cave.objects.filter(kataster_number = cave_id)[0] cave_and_ent = CaveAndEntrance.objects.filter(cave = cave).filter(entrance_letter = ent_letter)[0] - return render_to_response('entrance.html', {'cave': cave, + return render_response(request,'entrance.html', {'cave': cave, 'entrance': cave_and_ent.entrance, - 'letter': cave_and_ent.entrance_letter, - 'settings': settings}) + 'letter': cave_and_ent.entrance_letter,}) + def survexblock(request, survexpath): survexblock = models.SurvexBlock.objects.get(survexpath=survexpath) #ftext = survexblock.filecontents() ftext = survexblock.text - return render_to_response('survexblock.html', {'survexblock':survexblock, 'ftext':ftext, 'settings':settings }) + return render_response(request,'survexblock.html', {'survexblock':survexblock, 'ftext':ftext, }) def caveArea(request, name): cavearea = models.CaveArea.objects.get(name = name) cave = cavearea.cave - return render_to_response('cavearea.html', {'cavearea': cavearea, 'cave': cave, 'settings':settings }) + return render_response(request,'cavearea.html', {'cavearea': cavearea, 'cave': cave,}) def caveSearch(request): query_string = '' found_entries = None if ('q' in request.GET) and request.GET['q'].strip(): query_string = request.GET['q'] - entry_query = search.get_query(query_string, ['underground_description','official_name',]) - found_entries = Cave.objects.filter(entry_query) + entry_query = search.get_query(query_string, ['underground_description','official_name',]) + found_entries = Cave.objects.filter(entry_query) - return render_to_response('cavesearch.html', - { 'query_string': query_string, 'found_entries': found_entries, 'settings': settings}) - #context_instance=RequestContext(request)) + return render_response(request,'cavesearch.html', + { 'query_string': query_string, 'found_entries': found_entries,}) def surveyindex(request): surveys=Survey.objects.all() expeditions=Expedition.objects.all() - dictToPass=locals() - dictToPass.update({'settings':settings}) - return render_to_response('survey.html',dictToPass) + return render_response(request,'survey.html',locals()) def survey(request,year,wallet_number): surveys=Survey.objects.all() @@ -63,9 +63,6 @@ def survey(request,year,wallet_number): notes=current_survey.scannedimage_set.filter(contents='notes') planSketches=current_survey.scannedimage_set.filter(contents='plan') elevationSketches=current_survey.scannedimage_set.filter(contents='elevation') - - dictToPass=locals() - dictToPass.update({'settings':settings}) - return render_to_response('survey.html',dictToPass) + return render_response(request,'survey.html', locals()) diff --git a/troggle/expo/views_logbooks.py b/troggle/expo/views_logbooks.py index a179c50f8..edf2f307c 100644 --- a/troggle/expo/views_logbooks.py +++ b/troggle/expo/views_logbooks.py @@ -6,11 +6,15 @@ from troggle.parsers.logbooks import LoadLogbookForExpedition from troggle.parsers.people import GetPersonExpeditionNameLookup from troggle.expo.forms import PersonForm +# Django uses Context, not RequestContext when you call render_to_response. We always want to use RequestContext, so that django adds the context from settings.TEMPLATE_CONTEXT_PROCESSORS. This way we automatically get necessary settings variables passed to each template. So we use a custom method, render_response instead of render_to_response. Hopefully future Django releases will make this unnecessary. +from troggle.alwaysUseRequestContext import render_response + import search import re 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 = [ ] ncols = 5 nc = (len(persons) + ncols - 1) / ncols @@ -18,7 +22,7 @@ def personindex(request): personss.append(persons[i * nc: (i + 1) * nc]) notablepersons = Person.objects.filter(bisnotable=True) - return render_to_response('personindex.html', {'persons': persons, 'personss':personss, 'notablepersons':notablepersons, 'settings': settings}) + return render_response(request,'personindex.html', {'persons': persons, 'personss':personss, 'notablepersons':notablepersons, }) def expedition(request, expeditionname): year = int(expeditionname) @@ -30,22 +34,28 @@ def expedition(request, expeditionname): message = LoadLogbookForExpedition(expedition) #message = str(GetPersonExpeditionNameLookup(expedition).keys()) logbookentries = expedition.logbookentry_set.order_by('date') - return render_to_response('expedition.html', {'expedition': expedition, 'expedition_next':expedition_next, 'expedition_prev':expedition_prev, 'logbookentries':logbookentries, 'message':message, 'settings': settings}) + return render_response(request,'expedition.html', {'expedition': expedition, 'expedition_next':expedition_next, 'expedition_prev':expedition_prev, 'logbookentries':logbookentries, 'message':message, }) -def person(request, name): - person = Person.objects.get(href=name) - return render_to_response('person.html', {'person': person, 'settings': settings}) +def person(request, first_name='', last_name=''): + person = Person.objects.get(first_name = first_name, last_name = last_name) + return render_response(request,'person.html', {'person': person, }) + + def get_absolute_url(self): + return settings.URL_ROOT + self.first_name + '_' + self.last_name -def personexpedition(request, name, expeditionname): - person = Person.objects.get(href=name) - year = int(expeditionname) +#def person(request, name): +# person = Person.objects.get(href=name) +# + +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_to_response('personexpedition.html', {'personexpedition': personexpedition, 'settings': settings}) + return render_response(request,'personexpedition.html', {'personexpedition': personexpedition, }) -def logbookentry(request, logbookentry_id): - logbookentry = LogbookEntry.objects.filter(href = logbookentry_id)[0] - return render_to_response('logbookentry.html', {'logbookentry': logbookentry, 'settings': settings}) +def logbookentry(request, logbookentry_pk): + logbookentry = LogbookEntry.objects.get(pk = logbookentry_pk) + return render_response(request, 'logbookentry.html', {'logbookentry': logbookentry, }) def logbookSearch(request, extra): query_string = '' @@ -55,11 +65,11 @@ def logbookSearch(request, extra): entry_query = search.get_query(query_string, ['text','title',]) found_entries = LogbookEntry.objects.filter(entry_query) - return render_to_response('logbooksearch.html', - { 'query_string': query_string, 'found_entries': found_entries, 'settings': settings}) + return render_response(request,'logbooksearch.html', + { 'query_string': query_string, 'found_entries': found_entries, }) #context_instance=RequestContext(request)) def personForm(request,pk): person=Person.objects.get(pk=pk) form=PersonForm(instance=person) - return render_to_response('personform.html', {'form':form,'settings':settings}) \ No newline at end of file + return render_response(request,'personform.html', {'form':form,}) \ No newline at end of file diff --git a/troggle/expo/views_other.py b/troggle/expo/views_other.py index e41329721..d890a6ecf 100644 --- a/troggle/expo/views_other.py +++ b/troggle/expo/views_other.py @@ -1,4 +1,3 @@ -from django.shortcuts import render_to_response from troggle.expo.models import Cave, Expedition, Person, LogbookEntry, PersonExpedition import troggle.settings as settings from django import forms @@ -9,6 +8,7 @@ from troggle.parsers.survex import LoadAllSurvexBlocks import randSent from django.core.urlresolvers import reverse +from troggle.alwaysUseRequestContext import render_response # see views_logbooks for explanation on this. def stats(request): statsDict={} @@ -16,7 +16,7 @@ def stats(request): statsDict['caveCount'] = int(Cave.objects.count()) statsDict['personCount'] = int(Person.objects.count()) statsDict['logbookEntryCount'] = int(LogbookEntry.objects.count()) - return render_to_response('statistics.html', statsDict) + return render_response(request,'statistics.html', statsDict) def frontpage(request): message = "no test message" #reverse('personn', kwargs={"name":"hkjhjh"}) @@ -29,7 +29,7 @@ def frontpage(request): #'randSent':randSent.randomLogbookSentence(), expeditions = Expedition.objects.order_by("-year") - return render_to_response('index.html', {'expeditions':expeditions, 'settings':settings, 'all':'all', "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'] @@ -37,6 +37,4 @@ def calendar(request,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) + return render_response(request,'calendar.html', locals()) diff --git a/troggle/parsers/people.py b/troggle/parsers/people.py index 2fda46ea7..9c7940c66 100644 --- a/troggle/parsers/people.py +++ b/troggle/parsers/people.py @@ -58,7 +58,7 @@ def LoadPersonsExpos(): years = headers[5:] years.append("2008") for year in years: - expedition = models.Expedition(year = year, name = "CUCC expo%s" % year) + expedition = models.Expedition(year = year, name = "CUCC expo %s" % year) expedition.save() diff --git a/troggle/parsers/surveys.py b/troggle/parsers/surveys.py index 687bbb0ed..cd9781be6 100644 --- a/troggle/parsers/surveys.py +++ b/troggle/parsers/surveys.py @@ -1,28 +1,24 @@ import sys import os -import urllib import types -#sys.path.append('C:\\Expo\\expoweb') +sys.path.append('C:\\Expo\\expoweb') from troggle import * -#os.environ['DJANGO_SETTINGS_MODULE']='troggle.settings' +os.environ['DJANGO_SETTINGS_MODULE']='troggle.settings' import troggle.settings as settings import troggle.expo.models as models -import troggle.expo.fileAbstraction as fileAbstraction #import settings #import expo.models as models import csv import re import datetime -import cStringIO -surveytab = fileAbstraction.readFile("Surveys.csv") -dialect=csv.Sniffer().sniff(surveytab) -surveyreader = csv.reader(cStringIO.StringIO(surveytab),dialect=dialect) -print surveyreader +surveytab = open(os.path.join(settings.SURVEYS, "Surveys.csv")) +dialect=csv.Sniffer().sniff(surveytab.read()) +surveytab.seek(0,0) +surveyreader = csv.reader(surveytab,dialect=dialect) headers = surveyreader.next() header = dict(zip(headers, range(len(headers)))) #set up a dictionary where the indexes are header names and the values are column numbers -print header # test if the expeditions have been added yet if len(models.Expedition.objects.all())==0: @@ -31,10 +27,9 @@ if len(models.Expedition.objects.all())==0: models.ScannedImage.objects.all().delete() models.Survey.objects.all().delete() for survey in surveyreader: - print type(survey), survey walletNumberLetter = re.match(r'(?P\d*)(?P[a-zA-Z]*)',survey[header['Survey Number']]) #I hate this, but some surveys have a letter eg 2000#34a. This line deals with that. # print walletNumberLetter.groups() - + surveyobj = models.Survey( expedition = models.Expedition.objects.filter(year=survey[header['Year']])[0], wallet_number = walletNumberLetter.group('number'), @@ -48,16 +43,15 @@ for survey in surveyreader: pass surveyobj.save() print "added survey " + survey[header['Year']] + "#" + surveyobj.wallet_number - + # add survey scans def parseSurveyScans(year): - yearDirList = fileAbstraction.dirsAsList(year.year) - for surveyFolder in yearDirList: - print surveyFolder + yearPath=os.path.join(settings.SURVEYS, year.year) + yearFileList=os.listdir(yearPath) + for surveyFolder in yearFileList: try: surveyNumber=re.match(r'\d\d\d\d#0*(\d+)',surveyFolder).groups() - scanList=fileAbstraction.filesAsList(year.year, surveyFolder) - print "BAR: ", year.year, surveyFolder, scanList + scanList=os.listdir(os.path.join(yearPath,surveyFolder)) except AttributeError: print surveyFolder + " ignored" continue @@ -65,7 +59,6 @@ def parseSurveyScans(year): for scan in scanList: try: scanChopped=re.match(r'(?i).*(notes|elev|plan|elevation|extend)(\d*)\.(png|jpg|jpeg)',scan).groups() - print "BAR: ", scanChopped scanType,scanNumber,scanFormat=scanChopped except AttributeError: print "Adding scans: " + scan + " ignored" @@ -82,14 +75,14 @@ def parseSurveyScans(year): survey=models.Survey.objects.get_or_create(wallet_number=surveyNumber, expedition=year)[0] except models.Survey.MultipleObjectsReturned: survey=models.Survey.objects.filter(wallet_number=surveyNumber, expedition=year)[0] - + scanObj = models.ScannedImage( file=os.path.join(year.year, surveyFolder, scan), contents=scanType, number_in_wallet=scanNumber, survey=survey ) - print "Added scanned image at " + str(scanObj) + #print "Added scanned image at " + str(scanObj) scanObj.save() for year in models.Expedition.objects.filter(year__gte=2000): #expos since 2000, because paths and filenames were nonstandard before then diff --git a/troggle/settings.py b/troggle/settings.py index 9ad299d62..f22bd369a 100644 --- a/troggle/settings.py +++ b/troggle/settings.py @@ -46,7 +46,7 @@ TEMPLATE_LOADERS = ( # 'django.template.loaders.eggs.load_template_source', ) -TEMPLATE_CONTEXT_PROCESSORS = ( "django.core.context_processors.auth", "troggle.context.settingsContext") +TEMPLATE_CONTEXT_PROCESSORS = ( "django.core.context_processors.auth", "expo.context.settings_context", ) LOGIN_REDIRECT_URL = '/' diff --git a/troggle/templates/calendar.html b/troggle/templates/calendar.html index b4ad49db5..5ff27786a 100644 --- a/troggle/templates/calendar.html +++ b/troggle/templates/calendar.html @@ -21,6 +21,18 @@ {% endblock %} +{% block contentheader %} +

Expedition members present calendar for {{ expedition.year }}

+ + + + + + +
Expedition member present in Austria
Expedition member absent in Austria
+
+{% endblock%} + {% block content %} {% if expedition %} @@ -47,7 +59,8 @@ {% for personexpedition in expedition.personexpedition_set.all %} {% if personexpedition.ListDaysTF %} {% for dateTF in personexpedition.ListDaysTF %} diff --git a/troggle/templates/cave.html b/troggle/templates/cave.html index 495e2f73d..c97b9cdc3 100644 --- a/troggle/templates/cave.html +++ b/troggle/templates/cave.html @@ -10,7 +10,7 @@ {% if logbookentry.title %} - + {% endif %} {% endfor %} diff --git a/troggle/templates/caveindex.html b/troggle/templates/caveindex.html index b38e69fec..d9e47480e 100644 --- a/troggle/templates/caveindex.html +++ b/troggle/templates/caveindex.html @@ -8,14 +8,14 @@

Notable caves

All caves

diff --git a/troggle/templates/expedition.html b/troggle/templates/expedition.html index e4f12f05f..b6be4aca1 100644 --- a/troggle/templates/expedition.html +++ b/troggle/templates/expedition.html @@ -1,52 +1,52 @@ -{% extends "base.html" %} -{% load wiki_markup %} - -{% block title %}Expedition {{expedition.name}}{% endblock %} - -{% block content %} -

{{expedition.name}}: {{expedition.date_from}} - {{expedition.date_to}}

- -
-
- {{ personexpedition.person }} + {{ personexpedition.person }} +
{{logbookentry.date}}{{logbookentry.title|safe}}{{logbookentry.title|safe}}
- - - - - - -
{% if expedition_prev %}< < {{expedition_prev.year}}{% endif %}{% if expedition_next %}> > {{expedition_next.year}}{% endif %}
- -{% for personexpedition in expedition.personexpedition_set.all %} - - - - - -{% endfor %} -
CaverFromTo
{{personexpedition.person}}{{personexpedition.date_from}}{{personexpedition.date_to}}
- - -
-

Logbook entries

-
-

debug message: {{message}}

- - - -{% for logbookentry in logbookentries %} - - - - - - {% if logbookentry.cave %} - - {% else %} - - {% endif %} - -{% endfor %} -
DateTitleAuthorPlace
{{logbookentry.date}}{{logbookentry.title|safe}}{{logbookentry.author.name}}{{logbookentry.place}}{{logbookentry.place}}
-
- -{% endblock %} +{% extends "base.html" %} +{% load wiki_markup %} + +{% block title %}Expedition {{expedition.name}}{% endblock %} + +{% block content %} +

{{expedition.name}}: {{expedition.date_from}} - {{expedition.date_to}}

+ +
+ + + + + + + +
{% if expedition_prev %}< < {{expedition_prev.year}}{% endif %}{% if expedition_next %}> > {{expedition_next.year}}{% endif %}
+ +{% for personexpedition in expedition.personexpedition_set.all %} + + + + + +{% endfor %} +
CaverFromTo
{{personexpedition.person}}{{personexpedition.date_from}}{{personexpedition.date_to}}
+
+ +
+

Logbook entries

+
+

debug message: {{message}}

+ + + +{% for logbookentry in logbookentries %} + + + + + + {% if logbookentry.cave %} + + {% else %} + + {% endif %} + +{% endfor %} +
DateTitleAuthorPlace
{{logbookentry.date}}{{logbookentry.title|safe}}{{logbookentry.author.name}}{{logbookentry.place}}{{logbookentry.place}}
+
+ +{% endblock %} diff --git a/troggle/templates/logbookentry.html b/troggle/templates/logbookentry.html index 613f2bf17..2bfb564b1 100644 --- a/troggle/templates/logbookentry.html +++ b/troggle/templates/logbookentry.html @@ -4,23 +4,24 @@ {% block title %}Logbook {{logbookentry.id}}{% endblock %} {% block content %} +

{{logbookentry.title|safe}}

-

{{logbookentry.expedition.name}}

+

{{logbookentry.expedition.name}}

{% if logbookentry.cave %} -

place: {{logbookentry.place}}

+

place: {{logbookentry.place}}

{% else %}

{{logbookentry.place}}

{% endif %}

{% if logbookentry.get_previous_by_date %} - {{logbookentry.get_previous_by_date.date}} + {{logbookentry.get_previous_by_date.date}} {% endif %} {% if logbookentry.get_next_by_date %} - {{logbookentry.get_next_by_date.date}} + {{logbookentry.get_next_by_date.date}} {% endif %}

@@ -33,7 +34,7 @@ {% else %} {% endifequal %} - {{persontrip.person_expedition.person}} + {{persontrip.person_expedition.person}} @@ -44,12 +45,12 @@ {% if persontrip.get_previous_by_date %} - {{persontrip.get_previous_by_date.date}} + {{persontrip.get_previous_by_date.date}} {% endif %} {% if persontrip.get_next_by_date %} - {{persontrip.get_next_by_date.date}} + {{persontrip.get_next_by_date.date}} {% endif %} diff --git a/troggle/templates/person.html b/troggle/templates/person.html index 140aa8d32..8f8c8207e 100644 --- a/troggle/templates/person.html +++ b/troggle/templates/person.html @@ -8,7 +8,7 @@

{{person|wiki_to_html_short}} has been on expo in the following years:

{% for personexpedition in person.personexpedition_set.all %} - | {{personexpedition.expedition.year}} + | {{personexpedition.expedition.year}} {% endfor %}

diff --git a/troggle/templates/personexpedition.html b/troggle/templates/personexpedition.html index e1e481bc0..ca1080ccf 100644 --- a/troggle/templates/personexpedition.html +++ b/troggle/templates/personexpedition.html @@ -9,8 +9,8 @@

{{message}}

-

Main page for expedition: {{personexpedition.expedition}}

-

Main page for person: {{personexpedition.person}}

+

Main page for expedition: {{personexpedition.expedition}}

+

Main page for person: {{personexpedition.person}}

List of other expos by this person

@@ -18,7 +18,7 @@ {% ifequal otherpersonexpedition personexpedition %} | {{otherpersonexpedition.expedition.year}} {% else %} - | {{otherpersonexpedition.expedition.year}} + | {{otherpersonexpedition.expedition.year}} {% endifequal %} {% endfor %}

@@ -35,10 +35,10 @@ {% for persontrip in persondate.1.persontrips %} - + {% if persontrip.logbook_entry.cave %} - + {% else %} {% endif %} diff --git a/troggle/templates/personindex.html b/troggle/templates/personindex.html index 5ffbe4d85..e684ad838 100644 --- a/troggle/templates/personindex.html +++ b/troggle/templates/personindex.html @@ -10,9 +10,9 @@ {% for person in notablepersons %} - - - + + + {% endfor %} @@ -28,9 +28,9 @@ {% for person in persons %} - - - + + + {% endfor %}
{{persontrip.logbook_entry.title|safe}}{{persontrip.logbook_entry.title|safe}}{{persontrip.place}}{{persontrip.place}}{{persontrip.place}}
PersonFirstLastNotability
{{person|wiki_to_html_short}}{{person.Firstexpedition.expedition.year}}{{person.Lastexpedition.expedition.year}}{{person|wiki_to_html_short}}{{ person.personexpedition_set.all.0.expedition.year }}{{ person.personexpedition_set.latest.expedition.year }} {{person.notability}}
PersonFirstLast
{{person|wiki_to_html_short}}{{person.Firstexpedition.expedition.year}}{{person.Lastexpedition.expedition.year}}{{person|wiki_to_html_short}}{{person.personexpedition_set.all.0.expedition.year}}{{person.personexpedition_set.latest.expedition.year}}
diff --git a/troggle/templates/survey.html b/troggle/templates/survey.html index 8f9e19008..e2e8c8053 100644 --- a/troggle/templates/survey.html +++ b/troggle/templates/survey.html @@ -85,7 +85,7 @@ select { margin:0.5em }
+

Choose a wallet number

+
+