mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
[svn]
Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8255 by aaron @ 2/23/2009 4:16 AM
This commit is contained in:
parent
b57452f68d
commit
8916b460e1
@ -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')
|
||||
|
||||
|
@ -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ür Hö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 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 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'),
|
||||
|
@ -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=''):
|
||||
|
@ -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):
|
||||
|
@ -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]
|
||||
|
@ -1,5 +1,9 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block contentheader %}
|
||||
<h1>Profile for {{ profile }}</h1>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{{ profile }}
|
||||
|
@ -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 %}
|
4
urls.py
4
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"),
|
||||
|
Loading…
Reference in New Issue
Block a user