summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-05-13 05:55:00 +0100
committersubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-05-13 05:55:00 +0100
commit8916b460e1b915d1a3aa32b3691da67b753f652b (patch)
treedd306a439c4a62188ba5a1f2e67e11cf811df19e
parentb57452f68de8f73c63222c61fdae84f900c3a190 (diff)
downloadtroggle-8916b460e1b915d1a3aa32b3691da67b753f652b.tar.gz
troggle-8916b460e1b915d1a3aa32b3691da67b753f652b.tar.bz2
troggle-8916b460e1b915d1a3aa32b3691da67b753f652b.zip
[svn]
Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8255 by aaron @ 2/23/2009 4:16 AM
-rw-r--r--expo/admin.py2
-rw-r--r--expo/models.py31
-rw-r--r--expo/views_caves.py2
-rw-r--r--expo/views_logbooks.py13
-rw-r--r--parsers/people.py2
-rw-r--r--templates/profiles/profile_detail.html4
-rw-r--r--templates/registration/registration_complete.html2
-rw-r--r--urls.py4
8 files changed, 41 insertions, 19 deletions
diff --git a/expo/admin.py b/expo/admin.py
index afad1ff..83a25fe 100644
--- a/expo/admin.py
+++ b/expo/admin.py
@@ -1,5 +1,6 @@
from troggle.expo.models import *
from django.contrib import admin
+#from troggle.reversion.admin import VersionAdmin #django-reversion version control
class RoleInline(admin.TabularInline):
model = PersonRole
@@ -15,6 +16,7 @@ class ScannedImageInline(admin.TabularInline):
class SurveyAdmin(admin.ModelAdmin):
inlines = (ScannedImageInline,)
+#class LogbookEntryAdmin(VersionAdmin):
class LogbookEntryAdmin(admin.ModelAdmin):
search_fields = ('title','expedition__year')
diff --git a/expo/models.py b/expo/models.py
index c55bfe8..79dbfbd 100644
--- a/expo/models.py
+++ b/expo/models.py
@@ -11,7 +11,13 @@ import datetime
from models_survex import *
-class Expedition(models.Model):
+class Model(models.Model):
+ new_since_parsing = models.BooleanField(default=False)
+ def save(self):
+ new_since_parsing = True
+ super(Model, self).save()
+
+class Expedition(Model):
year = models.CharField(max_length=20, unique=True)
name = models.CharField(max_length=100)
date_from = models.DateField(blank=True,null=True)
@@ -59,7 +65,7 @@ class Expedition(models.Model):
-class Person(models.Model):
+class Person(Model):
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
is_vfho = models.BooleanField(help_text="VFHO is the Vereines f&uuml;r H&ouml;hlenkunde in Obersteier, a nearby Austrian caving club.")
@@ -93,15 +99,15 @@ class Person(models.Model):
# def Lastexpedition(self):
# return self.personexpedition_set.order_by('-expedition')[0]
- #def notability(self):
- #notability = 0.0
- #for personexpedition in person.personexpedition_set.all():
- #if not personexpedition.is_guest:
- #notability += 1.0 / (2012 - int(self.personexpedition.expedition.year))
- #return notability
-
- #def bisnotable(self):
- #return self.notability > 0.3
+ def notability(self):
+ notability = 0.0
+ for personexpedition in Person.personexpedition_set.all():
+ if not personexpedition.is_guest:
+ notability += 1.0 / (2012 - int(self.personexpedition.expedition.year))
+ return notability
+
+ def bisnotable(self):
+ return self.notability > 0.3
#def Sethref(self):
#if self.last_name:
@@ -113,12 +119,11 @@ class Person(models.Model):
#self.notability = 0.0 # set temporarily
-class PersonExpedition(models.Model):
+class PersonExpedition(Model):
expedition = models.ForeignKey(Expedition)
person = models.ForeignKey(Person)
date_from = models.DateField(blank=True,null=True)
date_to = models.DateField(blank=True,null=True)
- dates_guessed = models.BooleanField(default=False)
is_guest = models.BooleanField(default=False)
COMMITTEE_CHOICES = (
('leader','Expo leader'),
diff --git a/expo/views_caves.py b/expo/views_caves.py
index f2ddad8..005a8cd 100644
--- a/expo/views_caves.py
+++ b/expo/views_caves.py
@@ -8,7 +8,7 @@ from troggle.alwaysUseRequestContext import render_response # see views_logbooks
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 ]
+ notablecaves = [Cave.objects.get(kataster_number=kataster_number) for kataster_number in notablecavehrefs ]
return render_response(request,'caveindex.html', {'caves': caves, 'notablecaves':notablecaves})
def cavehref(request, cave_id='', offical_name=''):
diff --git a/expo/views_logbooks.py b/expo/views_logbooks.py
index 38aeac6..fae7491 100644
--- a/expo/views_logbooks.py
+++ b/expo/views_logbooks.py
@@ -14,6 +14,13 @@ import re
@models.permalink #this allows the nice get_absolute_url syntax we are using
+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
@@ -23,7 +30,11 @@ def personindex(request):
for i in range(ncols):
personss.append(persons[i * nc: (i + 1) * nc])
- notablepersons = Person.objects.filter(bisnotable=True)
+ notablepersons = []
+ for person in Person.objects.all():
+ if person.bisnotable():
+ notablepersons.append(person)
+
return render_response(request,'personindex.html', {'persons': persons, 'personss':personss, 'notablepersons':notablepersons, })
def expedition(request, expeditionname):
diff --git a/parsers/people.py b/parsers/people.py
index 3a8fb05..269f13b 100644
--- a/parsers/people.py
+++ b/parsers/people.py
@@ -106,7 +106,7 @@ def LoadPersonsExpos():
persons = list(models.Person.objects.filter(first_name=firstname, last_name=lastname))
if not persons:
person = models.Person(first_name=firstname, last_name = lastname, is_vfho = False, mug_shot = "")
- person.Sethref()
+ #person.Sethref()
person.save()
else:
person = persons[0]
diff --git a/templates/profiles/profile_detail.html b/templates/profiles/profile_detail.html
index 543785f..baf3fae 100644
--- a/templates/profiles/profile_detail.html
+++ b/templates/profiles/profile_detail.html
@@ -1,5 +1,9 @@
{% extends "base.html" %}
+{% block contentheader %}
+<h1>Profile for {{ profile }}</h1>
+{% endblock %}
+
{% block content %}
{{ profile }}
diff --git a/templates/registration/registration_complete.html b/templates/registration/registration_complete.html
index 7cc8ab2..5351574 100644
--- a/templates/registration/registration_complete.html
+++ b/templates/registration/registration_complete.html
@@ -9,5 +9,5 @@ registration_complete.html | {{ block.super }}
{% endblock %}
{% block content %}
-Thank you for signing up, {{ user.username }}. An email with the activation code has been sent to your inbox. Please <a href={% url profiles_create_profile %}> create your profile</a>. If you have been on the expedition in the past, this step allows existing expedition data to be linked to your new account.
+Thank you for signing up, {{ user.username }}. An email with the activation code has been sent to your inbox. If you have been on the expedition in the past, you already have a profile in the system; <a href={% url profiles_select_profile %}>click here </a> to find it and link it to your account. Otherwise, please <a href={% url profiles_create_profile %}> create yourself a new profile</a>. If you have been on the expedition in the past, this step allows existing expedition data to be linked to your new account.
{% endblock %} \ No newline at end of file
diff --git a/urls.py b/urls.py
index a701ba1..6c54916 100644
--- a/urls.py
+++ b/urls.py
@@ -12,12 +12,12 @@ urlpatterns = patterns('',
url(r'^$', views_other.frontpage, name="frontpage"),
- url(r'^caveindex$', views_caves.caveindex, name="caveindex"),
+ url(r'^caveindex/?$', views_caves.caveindex, name="caveindex"),
url(r'^personindex$', views_logbooks.personindex, name="personindex"),
#(r'^person/(?P<person_id>\d*)/?$', views_logbooks.person),
- url(r'^person/(?P<first_name>[A-Z]*[a-z]*)[^a-zA-Z]*(?P<last_name>[A-Z]*[a-z]*)/?', views_logbooks.person, name="person"),
+ url(r'^person/(?P<first_name>[A-Z]*[a-z\-\']*)[^a-zA-Z]*(?P<last_name>[A-Z]*[a-z\-]*)/?', views_logbooks.person, name="person"),
#url(r'^person/(\w+_\w+)$', views_logbooks.person, name="person"),
url(r'^expedition/(\d+)$', views_logbooks.expedition, name="expedition"),