diff options
author | substantialnoninfringinguser <substantialnoninfringinguser@gmail.com> | 2009-05-13 05:44:35 +0100 |
---|---|---|
committer | substantialnoninfringinguser <substantialnoninfringinguser@gmail.com> | 2009-05-13 05:44:35 +0100 |
commit | 264594ed05b2723f443798a326d07afbbdaf185f (patch) | |
tree | cd482abf252c31f0fe9fc88796bf6eb45e6e20c9 /expo/models.py | |
parent | 1e1453f44351e0c8b7b725e008ef33bc53c70689 (diff) | |
download | troggle-264594ed05b2723f443798a326d07afbbdaf185f.tar.gz troggle-264594ed05b2723f443798a326d07afbbdaf185f.tar.bz2 troggle-264594ed05b2723f443798a326d07afbbdaf185f.zip |
[svn] made index of people
Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8224 by julian @ 1/24/2009 6:26 PM
Diffstat (limited to 'expo/models.py')
-rw-r--r-- | expo/models.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/expo/models.py b/expo/models.py index b8885ea..50140aa 100644 --- a/expo/models.py +++ b/expo/models.py @@ -19,6 +19,9 @@ class Expedition(models.Model): def __unicode__(self):
return self.year
+ class Meta:
+ ordering = ('year',)
+
def GuessDateFrom(self):
try:
return self.logbookentry_set.order_by('date')[0].date
@@ -71,12 +74,20 @@ class Person(models.Model): class Meta:
verbose_name_plural = "People"
+ class Meta:
+ ordering = ('last_name', 'first_name')
def __unicode__(self):
if self.last_name:
return "%s %s" % (self.first_name, self.last_name)
return self.first_name
+ # 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]
+
class PersonExpedition(models.Model):
expedition = models.ForeignKey(Expedition)
@@ -96,6 +107,9 @@ class PersonExpedition(models.Model): print res
return res
+ class Meta:
+ ordering = ('expedition',)
+
def GetPersonChronology(self):
res = { }
for persontrip in self.persontrip_set.all():
|