diff options
author | substantialnoninfringinguser <substantialnoninfringinguser@gmail.com> | 2009-05-13 06:09:55 +0100 |
---|---|---|
committer | substantialnoninfringinguser <substantialnoninfringinguser@gmail.com> | 2009-05-13 06:09:55 +0100 |
commit | 6137f8baaadccfa5019f36dfab1d43bbdb230629 (patch) | |
tree | 8ed279cefaa6a70f5f896a04f9008c51e28e98e8 /expo/models.py | |
parent | d6244e1ef3786be26931b1a3d772c6788a354d34 (diff) | |
download | troggle-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 'expo/models.py')
-rw-r--r-- | expo/models.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/expo/models.py b/expo/models.py index 56fbf01..485468c 100644 --- a/expo/models.py +++ b/expo/models.py @@ -10,6 +10,7 @@ import os from django.conf import settings
import datetime
from decimal import Decimal, getcontext
+from django.core.urlresolvers import reverse
getcontext().prec=2 #use 2 significant figures for decimal calculations
from models_survex import *
@@ -211,6 +212,7 @@ class LogbookEntry(TroggleModel): cave = models.ForeignKey('Cave',blank=True,null=True)
place = models.CharField(max_length=100,blank=True,null=True)
text = models.TextField()
+ slug = models.SlugField(max_length=100)
#href = models.CharField(max_length=100)
@@ -224,7 +226,7 @@ class LogbookEntry(TroggleModel): ordering = ('-date',)
def get_absolute_url(self):
- return settings.URL_ROOT + "/logbookentry/" + str(self.pk)
+ return settings.URL_ROOT + reverse('logbookentry',kwargs={'date':self.date,'slug':self.slug})
def __unicode__(self):
return "%s: (%s)" % (self.date, self.title)
|