mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
[svn] yorkshire work with tunnel integration
Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8232 by julian @ 1/29/2009 11:40 PM
This commit is contained in:
parent
ed345f2576
commit
cb52c47aa9
122
expo/models.py
122
expo/models.py
@ -23,6 +23,7 @@ class Expedition(models.Model):
|
||||
class Meta:
|
||||
ordering = ('year',)
|
||||
|
||||
# lose these two functions (inelegant, and we may create a file with the dates that we can load from)
|
||||
def GuessDateFrom(self):
|
||||
try:
|
||||
return self.logbookentry_set.order_by('date')[0].date
|
||||
@ -59,13 +60,17 @@ class Person(models.Model):
|
||||
is_vfho = models.BooleanField(help_text="VFHO is the Vereines für Höhlenkunde in Obersteier, a nearby Austrian caving club.")
|
||||
mug_shot = models.CharField(max_length=100, blank=True,null=True)
|
||||
blurb = models.TextField(blank=True,null=True)
|
||||
|
||||
href = models.CharField(max_length=200)
|
||||
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)
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "People"
|
||||
class Meta:
|
||||
ordering = ('last_name', 'first_name')
|
||||
ordering = ('orderref',) # "Wookey" makes too complex for: ('last_name', 'first_name')
|
||||
|
||||
def __unicode__(self):
|
||||
if self.last_name:
|
||||
@ -78,6 +83,15 @@ class Person(models.Model):
|
||||
def Lastexpedition(self):
|
||||
return self.personexpedition_set.order_by('-expedition')[0]
|
||||
|
||||
def Sethref(self):
|
||||
if self.last_name:
|
||||
self.href = self.first_name.lower() + "_" + self.last_name.lower()
|
||||
self.orderref = self.last_name + " " + self.first_name
|
||||
else:
|
||||
self.href = self.first_name.lower()
|
||||
self.orderref = self.first_name
|
||||
self.notability = 0.0 # set temporarily
|
||||
|
||||
|
||||
class PersonExpedition(models.Model):
|
||||
expedition = models.ForeignKey(Expedition)
|
||||
@ -94,7 +108,6 @@ class PersonExpedition(models.Model):
|
||||
res[-1]['roles'] += ", " + str(personrole.role)
|
||||
else:
|
||||
res.append({'date':personrole.survex_block.date, 'survexpath':personrole.survex_block.survexpath, 'roles':str(personrole.role)})
|
||||
print res
|
||||
return res
|
||||
|
||||
class Meta:
|
||||
@ -117,18 +130,8 @@ class PersonExpedition(models.Model):
|
||||
# needs converting dict into list
|
||||
return sorted(res.items())
|
||||
|
||||
|
||||
# deprecated
|
||||
def GetPossibleNameForms(self):
|
||||
res = [ ]
|
||||
if self.person.last_name:
|
||||
res.append("%s %s" % (self.person.first_name, self.person.last_name))
|
||||
res.append("%s %s" % (self.person.first_name, self.person.last_name[0]))
|
||||
res.append(self.person.first_name)
|
||||
if self.nickname:
|
||||
res.append(self.nickname)
|
||||
return res
|
||||
|
||||
# don't use tabs.
|
||||
# possibly not useful functions anyway
|
||||
def ListDays(self):
|
||||
if self.date_from and self.date_to:
|
||||
res=[]
|
||||
@ -156,13 +159,52 @@ class PersonExpedition(models.Model):
|
||||
return self.person.first_name
|
||||
|
||||
|
||||
#class LogbookSentanceRating(models.Model):
|
||||
# rating = models.IntegerField()
|
||||
# person_trip = models.ForeignKey(PersonTrip)
|
||||
# sentance_number = models.IntegerField()
|
||||
class LogbookEntry(models.Model):
|
||||
date = models.DateField()
|
||||
expedition = models.ForeignKey(Expedition,blank=True,null=True) # yes this is double-
|
||||
author = models.ForeignKey(PersonExpedition,blank=True,null=True) # the person who writes it up doesn't have to have been on the trip
|
||||
title = models.CharField(max_length=200)
|
||||
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)
|
||||
|
||||
# def __unicode__(self):
|
||||
# return person_trip
|
||||
# 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)
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "Logbook Entries"
|
||||
# several PersonTrips point in to this object
|
||||
class Meta:
|
||||
ordering = ('-date',)
|
||||
|
||||
def __unicode__(self):
|
||||
return "%s: (%s)" % (self.date, self.title)
|
||||
|
||||
|
||||
class PersonTrip(models.Model):
|
||||
person_expedition = models.ForeignKey(PersonExpedition)
|
||||
|
||||
# this will be a foreign key of the place(s) the trip went through
|
||||
# possibly a trip has a plurality of triplets pointing into it
|
||||
place = models.CharField(max_length=100)
|
||||
# should add cave thing here (copied from logbook maybe)
|
||||
date = models.DateField()
|
||||
time_underground = models.FloatField()
|
||||
logbook_entry = models.ForeignKey(LogbookEntry)
|
||||
is_logbook_entry_author = models.BooleanField()
|
||||
|
||||
persontrip_next = models.ForeignKey('PersonTrip', related_name='pnext', blank=True,null=True)
|
||||
persontrip_prev = models.ForeignKey('PersonTrip', related_name='pprev', blank=True,null=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return "%s %s (%s)" % (self.person_expedition, self.place, self.date)
|
||||
|
||||
|
||||
#
|
||||
# move following classes into models_cave
|
||||
#
|
||||
|
||||
class Area(models.Model):
|
||||
short_name = models.CharField(max_length=100)
|
||||
@ -266,46 +308,6 @@ class Cave(models.Model):
|
||||
res += "–" + prevR
|
||||
return res
|
||||
|
||||
class LogbookEntry(models.Model):
|
||||
date = models.DateField()
|
||||
expedition = models.ForeignKey(Expedition,blank=True,null=True) # yes this is double-
|
||||
author = models.ForeignKey(PersonExpedition,blank=True,null=True) # the person who writes it up doesn't have to have been on the trip
|
||||
title = models.CharField(max_length=200)
|
||||
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)
|
||||
|
||||
# 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)
|
||||
|
||||
class Meta:
|
||||
verbose_name_plural = "Logbook Entries"
|
||||
# several PersonTrips point in to this object
|
||||
class Meta:
|
||||
ordering = ('-date',)
|
||||
|
||||
def __unicode__(self):
|
||||
return "%s: (%s)" % (self.date, self.title)
|
||||
|
||||
class PersonTrip(models.Model):
|
||||
person_expedition = models.ForeignKey(PersonExpedition)
|
||||
|
||||
# this will be a foreign key of the place(s) the trip went through
|
||||
# possibly a trip has a plurality of triplets pointing into it
|
||||
place = models.CharField(max_length=100)
|
||||
# should add cave thing here (copied from logbook maybe)
|
||||
date = models.DateField()
|
||||
time_underground = models.FloatField()
|
||||
logbook_entry = models.ForeignKey(LogbookEntry)
|
||||
is_logbook_entry_author = models.BooleanField()
|
||||
|
||||
persontrip_next = models.ForeignKey('PersonTrip', related_name='pnext', blank=True,null=True)
|
||||
persontrip_prev = models.ForeignKey('PersonTrip', related_name='pprev', blank=True,null=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return "%s %s (%s)" % (self.person_expedition, self.place, self.date)
|
||||
|
||||
|
||||
class OtherCaveName(models.Model):
|
||||
|
@ -1,5 +1,21 @@
|
||||
import troggle.settings as settings
|
||||
import fileAbstraction
|
||||
from django.shortcuts import render_to_response
|
||||
from django.http import HttpResponse, Http404
|
||||
import os
|
||||
import re
|
||||
|
||||
# inline fileabstraction into here if it's not going to be useful anywhere else
|
||||
# keep things simple and ignore exceptions everywhere for now
|
||||
|
||||
def getMimeType(extension):
|
||||
try:
|
||||
return {"txt": "text/plain",
|
||||
"html": "text/html",
|
||||
}[extension]
|
||||
except:
|
||||
print "unknown file type"
|
||||
return "text/plain"
|
||||
|
||||
|
||||
def listdir(request, path):
|
||||
@ -13,16 +29,104 @@ def upload(request, path):
|
||||
|
||||
def download(request, path):
|
||||
#try:
|
||||
|
||||
return HttpResponse(fileAbstraction.readFile(path), mimetype=getMimeType(path.split(".")[-1]))
|
||||
#except:
|
||||
# raise Http404
|
||||
|
||||
|
||||
def getMimeType(extension):
|
||||
try:
|
||||
return {"txt": "text/plain",
|
||||
"html": "text/html",
|
||||
}[extension]
|
||||
except:
|
||||
print "unknown file type"
|
||||
return "text/plain"
|
||||
#
|
||||
# julian's quick hack for something that works
|
||||
# could signal directories by ending with /, and forward cases where it's missing
|
||||
#
|
||||
extmimetypes = {".txt": "text/plain",
|
||||
".html": "text/html",
|
||||
".png": "image/png",
|
||||
".jpg": "image/jpeg",
|
||||
}
|
||||
|
||||
def jgtfile(request, f):
|
||||
fp = os.path.join(settings.SURVEYS, f)
|
||||
# could also surf through SURVEX_DATA
|
||||
|
||||
# directory listing
|
||||
if os.path.isdir(fp):
|
||||
listdirfiles = [ ]
|
||||
listdirdirs = [ ]
|
||||
|
||||
for lf in sorted(os.listdir(fp)):
|
||||
hpath = os.path.join(f, lf) # not absolute path
|
||||
if lf[0] == "." or lf[-1] == "~":
|
||||
continue
|
||||
|
||||
hpath = hpath.replace("\\", "/") # for windows users
|
||||
href = hpath.replace("#", "%23") # '#' in file name annoyance
|
||||
|
||||
flf = os.path.join(fp, lf)
|
||||
if os.path.isdir(flf):
|
||||
nfiles = len([sf for sf in os.listdir(flf) if sf[0] != "."])
|
||||
listdirdirs.append((href, hpath + "/", nfiles))
|
||||
else:
|
||||
listdirfiles.append((href, hpath, os.path.getsize(flf)))
|
||||
|
||||
upperdirs = [ ]
|
||||
lf = f
|
||||
while lf:
|
||||
hpath = lf.replace("\\", "/") # for windows users
|
||||
if hpath[-1] != "/":
|
||||
hpath += "/"
|
||||
href = hpath.replace("#", "%23")
|
||||
lf = os.path.split(lf)[0]
|
||||
upperdirs.append((href, hpath))
|
||||
upperdirs.append(("", "/"))
|
||||
|
||||
return render_to_response('listdir.html', {'file':f, 'listdirfiles':listdirfiles, 'listdirdirs':listdirdirs, 'upperdirs':upperdirs, 'settings': settings})
|
||||
|
||||
# flat output of file when loaded
|
||||
if os.path.isfile(fp):
|
||||
ext = os.path.splitext(fp)[1].lower()
|
||||
mimetype = extmimetypes.get(ext, "text/plain")
|
||||
fin = open(fp)
|
||||
ftext = fin.read()
|
||||
fin.close()
|
||||
return HttpResponse(ftext, mimetype=mimetype)
|
||||
|
||||
return HttpResponse("unknown file::%s::" % f, mimetype = "text/plain")
|
||||
|
||||
|
||||
def SaveImageInDir(name, imgdir, fdata):
|
||||
print ("hihihihi", fdata, settings.SURVEYS)
|
||||
print os.path.join(settings.SURVEYS, imgdir)
|
||||
if not os.path.isdir(os.path.join(settings.SURVEYS, imgdir)):
|
||||
print "*** Must have directory '%s' in '%s'" % (imgdir, settings.SURVEYS)
|
||||
while True:
|
||||
fname = os.path.join(settings.SURVEYS, imgdir, name)
|
||||
if not os.path.exists(fname):
|
||||
break
|
||||
mname = re.match("(.*?)(?:-(\d+))?\.(png|jpg|jpeg)$(?i)", name)
|
||||
if mname:
|
||||
name = "%s-%d.%s" % (mname.group(1), int(mname.group(2) or "0") + 1, mname.group(3))
|
||||
print "saving file", fname
|
||||
fout = open(fname, "wb")
|
||||
fout.write(fdata.read())
|
||||
fout.close()
|
||||
res = os.path.join(imgdir, name)
|
||||
return res.replace("\\", "/")
|
||||
|
||||
def jgtuploadfile(request):
|
||||
filesuploaded = [ ]
|
||||
project, user, tunnelversion = request.POST["project"], request.POST["user"], request.POST["tunnelversion"]
|
||||
print (project, user, tunnelversion)
|
||||
for uploadedfile in request.FILES.values():
|
||||
if uploadedfile.field_name in ["tileimage", "backgroundimage"] and \
|
||||
uploadedfile.content_type in ["image/png", "image/jpeg"]:
|
||||
fname = user + "_" + re.sub("[\\\\/]", "-", uploadedfile.name) # very escaped \
|
||||
print fname
|
||||
fileuploaded = SaveImageInDir(fname, uploadedfile.field_name, uploadedfile)
|
||||
filesuploaded.append(settings.URL_ROOT + "/jgtfile/" + fileuploaded)
|
||||
#print "FF", request.FILES
|
||||
#print ("FFF", request.FILES.values())
|
||||
message = ""
|
||||
print "gothere"
|
||||
return render_to_response('fileupload.html', {'message':message, 'filesuploaded':filesuploaded, 'settings': settings})
|
||||
|
||||
|
@ -1,4 +1,7 @@
|
||||
from views_caves import *
|
||||
from views_survex import *
|
||||
from views_logbooks import *
|
||||
from views_other import *
|
||||
# primary namespace
|
||||
import view_surveys
|
||||
import views_caves
|
||||
import views_survex
|
||||
import views_logbooks
|
||||
import views_other
|
||||
|
||||
|
@ -7,15 +7,10 @@ import search
|
||||
|
||||
def caveindex(request):
|
||||
caves = Cave.objects.all()
|
||||
notablecavehrefs = [ "161", "204", "258", "76" ]
|
||||
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})
|
||||
|
||||
def cave(request, cave_id):
|
||||
#hm, we're only choosing by the number within kataster, needs to be fixed. Caves in 1626 will presumably not work. - AC 7DEC08
|
||||
cave = Cave.objects.filter(kataster_number = cave_id)[0]
|
||||
return render_to_response('cave.html', {'cave': cave, 'settings': settings})
|
||||
|
||||
def cavehref(request, href):
|
||||
cave = Cave.objects.get(href=href)
|
||||
return render_to_response('cave.html', {'cave': cave, 'settings': settings})
|
||||
|
@ -11,13 +11,14 @@ import re
|
||||
|
||||
def personindex(request):
|
||||
persons = Person.objects.all()
|
||||
|
||||
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})
|
||||
|
||||
notablepersons = Person.objects.filter(bisnotable=True)
|
||||
return render_to_response('personindex.html', {'persons': persons, 'personss':personss, 'notablepersons':notablepersons, 'settings': settings})
|
||||
|
||||
def expedition(request, expeditionname):
|
||||
year = int(expeditionname)
|
||||
@ -42,12 +43,10 @@ def personexpedition(request, name, expeditionname):
|
||||
personexpedition = person.personexpedition_set.get(expedition=expedition)
|
||||
return render_to_response('personexpedition.html', {'personexpedition': personexpedition, 'settings': settings})
|
||||
|
||||
|
||||
def logbookentry(request, logbookentry_id):
|
||||
logbookentry = LogbookEntry.objects.filter(href = logbookentry_id)[0]
|
||||
return render_to_response('logbookentry.html', {'logbookentry': logbookentry, 'settings': settings})
|
||||
|
||||
|
||||
def logbookSearch(request, extra):
|
||||
query_string = ''
|
||||
found_entries = None
|
||||
|
@ -18,7 +18,7 @@ def stats(request):
|
||||
statsDict['logbookEntryCount'] = int(LogbookEntry.objects.count())
|
||||
return render_to_response('statistics.html', statsDict)
|
||||
|
||||
def frontPage(request):
|
||||
def frontpage(request):
|
||||
message = "no test message" #reverse('personn', kwargs={"name":"hkjhjh"})
|
||||
if "reloadexpos" in request.GET:
|
||||
message = LoadPersonsExpos()
|
||||
|
@ -12,6 +12,11 @@ import datetime
|
||||
import os
|
||||
|
||||
|
||||
#
|
||||
# When we edit logbook entries, allow a "?" after any piece of data to say we've frigged it and
|
||||
# it can be checked up later from the hard-copy if necessary; or it's not possible to determin (name, trip place, etc)
|
||||
#
|
||||
|
||||
#
|
||||
# the logbook loading section
|
||||
#
|
||||
@ -72,7 +77,7 @@ def EnterLogIntoDbase(date, place, title, text, trippeople, expedition, logtime_
|
||||
lplace = place.lower()
|
||||
if lplace not in noncaveplaces:
|
||||
lbo.cave=GetCaveLookup().get(lplace)
|
||||
print "pppp %s |%s|" % (lplace, str(lbo.cave))
|
||||
#print "pppp %s |%s|" % (lplace, str(lbo.cave))
|
||||
|
||||
lbo.save()
|
||||
#print "ttt", date, place
|
||||
@ -289,6 +294,7 @@ def SetDatesFromLogbookEntries(expedition):
|
||||
|
||||
|
||||
def LoadLogbookForExpedition(expedition):
|
||||
print "deleting logbooks for", expedition
|
||||
expedition.logbookentry_set.all().delete()
|
||||
models.PersonTrip.objects.filter(person_expedition__expedition=expedition).delete()
|
||||
expowebbase = os.path.join(settings.EXPOWEB, "years")
|
||||
|
@ -52,81 +52,74 @@ def LoadPersonsExpos():
|
||||
headers = personreader.next()
|
||||
header = dict(zip(headers, range(len(headers))))
|
||||
|
||||
# make expeditions
|
||||
print "Loading expeditions"
|
||||
models.Expedition.objects.all().delete()
|
||||
years = headers[5:]
|
||||
years.append("2008")
|
||||
for year in years:
|
||||
y = models.Expedition(year = year, name = "CUCC expo%s" % year)
|
||||
y.save()
|
||||
print "lll", years
|
||||
expedition = models.Expedition(year = year, name = "CUCC expo%s" % year)
|
||||
expedition.save()
|
||||
|
||||
|
||||
# make persons
|
||||
print "Loading personexpeditions"
|
||||
models.Person.objects.all().delete()
|
||||
models.PersonExpedition.objects.all().delete()
|
||||
expoers2008 = """Edvin Deadman,Kathryn Hopkins,Djuke Veldhuis,Becka Lawson,Julian Todd,Natalie Uomini,Aaron Curtis,Tony Rooke,Ollie Stevens,Frank Tully,Martin Jahnke,Mark Shinwell,Jess Stirrups,Nial Peters,Serena Povia,Olly Madge,Steve Jones,Pete Harley,Eeva Makiranta,Keith Curtis""".split(",")
|
||||
expomissing = set(expoers2008)
|
||||
|
||||
for person in personreader:
|
||||
name = person[header["Name"]]
|
||||
for personline in personreader:
|
||||
name = personline[header["Name"]]
|
||||
name = re.sub("<.*?>", "", name)
|
||||
mname = re.match("(\w+)(?:\s((?:van |ten )?\w+))?(?:\s\(([^)]*)\))?", name)
|
||||
nickname = mname.group(3) or ""
|
||||
|
||||
if mname.group(3):
|
||||
nickname = mname.group(3)
|
||||
else:
|
||||
nickname = ""
|
||||
|
||||
firstname, lastname = mname.group(1), mname.group(2) or ""
|
||||
|
||||
print firstname, lastname, "NNN", nickname
|
||||
#assert lastname == person[header[""]], person
|
||||
|
||||
href = firstname.lower()
|
||||
if lastname:
|
||||
href += "_" + lastname.lower()
|
||||
pObject = models.Person(first_name = firstname,
|
||||
last_name = lastname, href=href,
|
||||
is_vfho = person[header["VfHO member"]],
|
||||
)
|
||||
|
||||
is_guest = person[header["Guest"]] == "1" # this is really a per-expo catagory; not a permanent state
|
||||
pObject.save()
|
||||
person = models.Person(first_name=mname.group(1), last_name=(mname.group(2) or ""))
|
||||
person.is_vfho = personline[header["VfHO member"]]
|
||||
person.Sethref()
|
||||
#print "NNNN", person.href
|
||||
is_guest = (personline[header["Guest"]] == "1") # this is really a per-expo catagory; not a permanent state
|
||||
person.save()
|
||||
#parseMugShotAndBlurb(firstname, lastname, person, header, pObject)
|
||||
|
||||
for year, attended in zip(headers, person)[5:]:
|
||||
yo = models.Expedition.objects.filter(year = year)[0]
|
||||
# make person expedition from table
|
||||
for year, attended in zip(headers, personline)[5:]:
|
||||
expedition = models.Expedition.objects.get(year=year)
|
||||
if attended == "1" or attended == "-1":
|
||||
pyo = models.PersonExpedition(person = pObject, expedition = yo, nickname=nickname, is_guest=is_guest)
|
||||
pyo.save()
|
||||
|
||||
# error
|
||||
elif (firstname, lastname) == ("Mike", "Richardson") and year == "2001":
|
||||
print "Mike Richardson(2001) error"
|
||||
pyo = models.PersonExpedition(person = pObject, expedition = yo, nickname=nickname, is_guest=is_guest)
|
||||
pyo.save()
|
||||
personexpedition = models.PersonExpedition(person=person, expedition=expedition, nickname=nickname, is_guest=is_guest)
|
||||
personexpedition.save()
|
||||
|
||||
|
||||
# this fills in those people for whom 2008 was their first expo
|
||||
print "Loading personexpeditions 2008"
|
||||
for name in expomissing:
|
||||
firstname, lastname = name.split()
|
||||
is_guest = name in ["Eeva Makiranta", "Keith Curtis"]
|
||||
print "2008:", name
|
||||
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()
|
||||
person = models.Person(first_name=firstname, last_name = lastname, is_vfho = False, mug_shot = "")
|
||||
person.Sethref()
|
||||
person.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()
|
||||
person = persons[0]
|
||||
expedition = models.Expedition.objects.get(year="2008")
|
||||
personexpedition = models.PersonExpedition(person=person, expedition=expedition, nickname="", is_guest=is_guest)
|
||||
personexpedition.save()
|
||||
|
||||
# could rank according to surveying as well
|
||||
print "Setting person notability"
|
||||
for person in models.Person.objects.all():
|
||||
person.notability = 0.0
|
||||
for personexpedition in person.personexpedition_set.all():
|
||||
if not personexpedition.is_guest:
|
||||
person.notability += 1.0 / (2012 - int(personexpedition.expedition.year))
|
||||
person.bisnotable = person.notability > 0.3 # I don't know how to filter by this
|
||||
person.save()
|
||||
|
||||
|
||||
# used in other referencing parser functions
|
||||
# expedition name lookup cached for speed (it's a very big list)
|
||||
Gpersonexpeditionnamelookup = { }
|
||||
def GetPersonExpeditionNameLookup(expedition):
|
||||
@ -135,9 +128,10 @@ def GetPersonExpeditionNameLookup(expedition):
|
||||
if res:
|
||||
return res
|
||||
|
||||
res = {}
|
||||
res = { }
|
||||
duplicates = set()
|
||||
|
||||
print "Calculating GetPersonExpeditionNameLookup for", expedition.year
|
||||
personexpeditions = models.PersonExpedition.objects.filter(expedition=expedition)
|
||||
for personexpedition in personexpeditions:
|
||||
possnames = [ ]
|
||||
|
@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
|
||||
<link rel="stylesheet" type="text/css" href="{{ settings.MEDIA_URL }}css/main3.css" />
|
||||
<link rel="stylesheet" type="text/css" href="{{ settings.MEDIA_URL }}css/main2.css" />
|
||||
|
||||
<title>{% block title %}THE TITLE{% endblock %}</title>
|
||||
|
||||
|
@ -7,10 +7,12 @@
|
||||
<h3>All trips done in this cave</h3>
|
||||
<table>
|
||||
{% for logbookentry in cave.logbookentry_set.all %}
|
||||
{% if logbookentry.title %}
|
||||
<tr>
|
||||
<td>{{logbookentry.date}}</td>
|
||||
<td><a href="{% url logbookentry logbookentry.href %}">{{logbookentry.title|safe}}</a></td>
|
||||
</tr>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
</div>
|
||||
|
18
templates/fileupload.html
Normal file
18
templates/fileupload.html
Normal file
@ -0,0 +1,18 @@
|
||||
<h2>Fileupload</h2>
|
||||
|
||||
<ul>
|
||||
{% for fileuploaded in filesuploaded %}
|
||||
<li>UPLOADEDFILE: {{fileuploaded}}
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<p>MESSAGE: {{message}}
|
||||
</p>
|
||||
|
||||
{% if not filesuploaded %}
|
||||
<form action="" method="POST">
|
||||
<p>file to upload</p>
|
||||
<p><input type="file" name="file1"/></p>
|
||||
<p><input type="submit" name="submit" value="Submit" /></p>
|
||||
</form>
|
||||
{% endif %}
|
@ -6,33 +6,39 @@
|
||||
{% block content %}
|
||||
|
||||
<h2>The unfinished front page</h2>
|
||||
<b>Work down through an expedition page link</b>
|
||||
<p class="indent"><b>Remaining work:</b>
|
||||
|
||||
<p>(separate out the recent/notable people) vast front-page layout table of folks and caving trips and years; </p>
|
||||
<p>parse 1995-1976 logbooks; </p>
|
||||
<p>name matching and spelling in survex files; </p>
|
||||
<p>detect T/U on log entries; </p>
|
||||
<p>Improve logbook wikihtml text</p>
|
||||
<p>match caves to log entries; </p>
|
||||
<p>simplify the survex parsing code (if necessary); </p>
|
||||
<p>links between logbooks and survex blocks to cave things; </p>
|
||||
<p>where are the subcaves; </p>
|
||||
<p>mini-tree of survexblocks; </p>
|
||||
<p>connect sketches to caves to survey blocks and render thumbnailwise; </p>
|
||||
<p>all images to start appearing in pages; and so on</p>
|
||||
<p>tables of trips per year per person;</p>
|
||||
|
||||
<h3>{{message}}</h3>
|
||||
|
||||
<ul>
|
||||
<li><b><a href="{% url personindex %}">List of People</a></b></li>
|
||||
<li><b><a href="{% url caveindex %}">List of Caves</a></b></li>
|
||||
<li><a href="/statistics">Statistics of what's loaded in the database</a></li>
|
||||
<li><a href="{% url survexindex all %}">Survex directory</a></li>
|
||||
<li><a href="{% url jgtfile aaaa %}">JGT list of files</a> (temporary simple file list and tunnel use)</li>
|
||||
<li><a href="{% url survey %}">Survey files</a></li>
|
||||
<li><a href="{% url survexindex all %}">Survex directory</a></li>
|
||||
<li><a href="{% url expedition 2008 %}">Expedition 2008</a></li>
|
||||
<li><a href="{% url expedition 2007 %}">Expedition 2007</a></li>
|
||||
<li><a href="{% url expedition 1996 %}">Expedition 1996</a></li>
|
||||
</ul>
|
||||
|
||||
<h2>Further work</h2>
|
||||
|
||||
<p>surf through the tunnel sketches and images</p>
|
||||
<p>bugs with all.svx block (double dot)
|
||||
<p>name matching and spelling in survex files; </p>
|
||||
<p>render bitmap view of every survex block as a thumbnail</p>
|
||||
<p>upload tunnel images and tunnel sketches</p>
|
||||
<p>parse 1995-1976 logbooks; (esp top 161)</p>
|
||||
<p>where are the subcaves; </p>
|
||||
<p>cave section entrance match for logbook entries</p>
|
||||
<p>detect T/U on log entries; </p>
|
||||
<p>Improve logbook wikihtml text</p>
|
||||
<p>simplify the survex parsing code (if necessary); </p>
|
||||
<p>wiki survex stop linegap between comment lins</p>
|
||||
<p>links between logbooks and survex blocks to cave things; </p>
|
||||
<p>mini-tree of survexblocks; </p>
|
||||
<p>connect sketches to caves to survey blocks and render thumbnailwise; </p>
|
||||
<p>all images to start appearing in pages; and so on</p>
|
||||
|
||||
<h3>{{message}}</h3>
|
||||
|
||||
<form action="" method="GET">
|
||||
<input type="submit" name="reloadexpos" value="Reload Expos">
|
||||
<input type="submit" name="reloadsurvex" value="Reload Survex">
|
||||
|
22
templates/listdir.html
Normal file
22
templates/listdir.html
Normal file
@ -0,0 +1,22 @@
|
||||
<h2>List file :{{file}}:</h2>
|
||||
|
||||
<h3>Files</h3>
|
||||
<ul>
|
||||
{% for lf in listdirfiles %}
|
||||
<li><a href="{% url jgtfile lf.0 %}">{{lf.1}}</a> ({{lf.2}} bytes)</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h3>Upperdirectories</h3>
|
||||
<ul>
|
||||
{% for lf in upperdirs %}
|
||||
<li><a href="{% url jgtfile lf.0 %}">{{lf.1}}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
<h3>Subdirectories</h3>
|
||||
<ul>
|
||||
{% for lf in listdirdirs %}
|
||||
<li><a href="{% url jgtfile lf.0 %}">{{lf.1}}</a> ({{lf.2}} files)</li>
|
||||
{% endfor %}
|
||||
</ul>
|
@ -5,6 +5,21 @@
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h2>Notable expoers</h2>
|
||||
<table>
|
||||
<tr><th>Person</th><th>First</th><th>Last</th><th>Notability</th></tr>
|
||||
{% for person in notablepersons %}
|
||||
<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>
|
||||
<td>{{person.notability}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
|
||||
<h2>All expoers</h2>
|
||||
<table>
|
||||
<tr>
|
||||
{% for persons in personss %}
|
||||
|
47
urls.py
47
urls.py
@ -1,43 +1,54 @@
|
||||
from django.conf.urls.defaults import *
|
||||
from expo.views import *
|
||||
import expo.view_surveys as view_surveys
|
||||
import troggle.settings as settings
|
||||
|
||||
from expo.views import * # flat import
|
||||
from expo.views_caves import *
|
||||
from expo.views_survex import *
|
||||
|
||||
from django.contrib import admin
|
||||
admin.autodiscover()
|
||||
|
||||
urlpatterns = patterns('',
|
||||
|
||||
(r'^$', frontPage),
|
||||
url(r'^caveindex$', caveindex, name="caveindex"),
|
||||
url(r'^cave/(?P<cave_id>[^/]+)/?$', cave),
|
||||
url(r'^$', views_other.frontpage, name="frontpage"),
|
||||
|
||||
url(r'^cavehref/(.+)$', cave, name="cave"),
|
||||
url(r'^caveindex$', views_caves.caveindex, name="caveindex"),
|
||||
url(r'^personindex$', views_logbooks.personindex, name="personindex"),
|
||||
|
||||
url(r'^person/(.+)$', views_logbooks.person, name="person"),
|
||||
url(r'^expedition/(\d+)$', views_logbooks.expedition, name="expedition"),
|
||||
url(r'^personexpedition/(.+?)/(\d+)$', views_logbooks.personexpedition, name="personexpedition"),
|
||||
url(r'^logbookentry/(.+)$', views_logbooks.logbookentry,name="logbookentry"),
|
||||
|
||||
url(r'^survexblock/(.+)$', views_caves.survexblock, name="survexblock"),
|
||||
url(r'^cavehref/(.+)$', views_caves.cavehref, name="cave"),
|
||||
|
||||
url(r'^jgtfile/(.*)$', view_surveys.jgtfile, name="jgtfile"),
|
||||
url(r'^jgtuploadfile$', view_surveys.jgtuploadfile, name="jgtuploadfile"),
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
(r'^cave/(?P<cave_id>[^/]+)/?(?P<ent_letter>[^/])$', ent),
|
||||
#(r'^cave/(?P<cave_id>[^/]+)/edit/$', edit_cave),
|
||||
(r'^cavesearch', caveSearch),
|
||||
url(r'^cavearea', caveArea, name="caveArea"),
|
||||
|
||||
url(r'^survex/(.*?)\.index$', index, name="survexindex"),
|
||||
url(r'^survex/(.*?)\.index$', views_survex.index, name="survexindex"),
|
||||
url(r'^cave/(?P<cave_id>[^/]+)/?$', views_caves.cavehref), # deprecated
|
||||
(r'^survex/(?P<survex_file>.*)\.svx$', svx),
|
||||
(r'^survex/(?P<survex_file>.*)\.3d$', threed),
|
||||
(r'^survex/(?P<survex_file>.*)\.log$', log),
|
||||
(r'^survex/(?P<survex_file>.*)\.err$', err),
|
||||
|
||||
url(r'^personindex$', personindex, name="personindex"),
|
||||
url(r'^person/(.+)$', person, name="person"),
|
||||
|
||||
url(r'^logbookentry/(.+)$', logbookentry, name="logbookentry"),
|
||||
url(r'^logbooksearch/(.*)/?$', logbookSearch),
|
||||
|
||||
url(r'^expedition/(\d+)$', expedition, name="expedition"),
|
||||
url(r'^personexpedition/(.+?)/(\d+)$', personexpedition, name="personexpedition"),
|
||||
url(r'^survexblock/(.+)$', survexblock, name="survexblock"),
|
||||
url(r'^logbooksearch/(.*)/?$', views_logbooks.logbookSearch),
|
||||
|
||||
|
||||
url(r'^statistics/?$', stats, name="stats"),
|
||||
url(r'^statistics/?$', views_other.stats, name="stats"),
|
||||
|
||||
url(r'^calendar/(?P<year>\d\d\d\d)?$', calendar, name="calendar"),
|
||||
url(r'^calendar/(?P<year>\d\d\d\d)?$', views_other.calendar, name="calendar"),
|
||||
|
||||
url(r'^survey/?$', surveyindex, name="survey"),
|
||||
(r'^survey/(?P<year>\d\d\d\d)\#(?P<wallet_number>\d*)$', survey),
|
||||
@ -48,7 +59,7 @@ urlpatterns = patterns('',
|
||||
(r'^accounts/', include('registration.urls')),
|
||||
(r'^profiles/', include('profiles.urls')),
|
||||
|
||||
(r'^personform/(.*)$', personForm),
|
||||
# (r'^personform/(.*)$', personForm),
|
||||
|
||||
(r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
|
||||
{'document_root': settings.MEDIA_ROOT, 'show_indexes': True}),
|
||||
|
Loading…
Reference in New Issue
Block a user