summaryrefslogtreecommitdiffstats
path: root/parsers/logbooks.py
diff options
context:
space:
mode:
authorsubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-05-13 06:09:55 +0100
committersubstantialnoninfringinguser <substantialnoninfringinguser@gmail.com>2009-05-13 06:09:55 +0100
commit6137f8baaadccfa5019f36dfab1d43bbdb230629 (patch)
tree8ed279cefaa6a70f5f896a04f9008c51e28e98e8 /parsers/logbooks.py
parentd6244e1ef3786be26931b1a3d772c6788a354d34 (diff)
downloadtroggle-6137f8baaadccfa5019f36dfab1d43bbdb230629.tar.gz
troggle-6137f8baaadccfa5019f36dfab1d43bbdb230629.tar.bz2
troggle-6137f8baaadccfa5019f36dfab1d43bbdb230629.zip
[svn] Logbook entries are now at /YYYY-MM-DD/slug .
Try editing a logbook entry title in the admin now. The django built in auto slug field is fun and javascripty. Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8308 by aaron @ 3/16/2009 7:27 PM
Diffstat (limited to 'parsers/logbooks.py')
-rw-r--r--parsers/logbooks.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/parsers/logbooks.py b/parsers/logbooks.py
index 9566d2d..976d71a 100644
--- a/parsers/logbooks.py
+++ b/parsers/logbooks.py
@@ -6,6 +6,8 @@ import troggle.expo.models as models
from troggle.parsers.people import GetPersonExpeditionNameLookup
from troggle.parsers.cavetab import GetCaveLookup
+from django.template.defaultfilters import slugify
+
import csv
import re
import datetime
@@ -286,7 +288,7 @@ def SetDatesFromLogbookEntries(expedition):
# lprevlogbookentry = logbookentry
# This combined date / number key is a weird way of doing things. Use the primary key instead. If we are going to use the date for looking up entries, we should set it up to allow multiple results.
-# # order by date for setting the references
+ # order by date for setting the references
# lprevlogbookentry = None
# for logbookentry in expedition.logbookentry_set.order_by('date'):
# if lprevlogbookentry and lprevlogbookentry.date == logbookentry.date:
@@ -297,6 +299,9 @@ def SetDatesFromLogbookEntries(expedition):
# logbookentry.href = "%s" % logbookentry.date
# logbookentry.save()
# lprevlogbookentry = logbookentry
+ for logbookentry in expedition.logbookentry_set.all():
+ logbookentry.slug = slugify(logbookentry.title)
+ logbookentry.save()
def LoadLogbookForExpedition(expedition):