On Mon, 2007-07-16 at 09:41 +0000, Robert wrote:
> Hello,
>
> I would like to use the permalink decorator for get_absolute_url
> method.
>
> Here's the code:
>
> There's a 'Post' model with 'created' -> models.DateTimeField()
> field.. (and others)
>
> @models.permalink
> get_absolute_url(sefl):
> return (post_detail, None, {
> 'year' : self.created.year,
> 'month' : self.created.month,
> 'day' : self.created.day,
> })
>
>
> urls.py
>
> (r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/
> $', post_detail, dict(post_date_dict, slug_field='slug'))
>
>
> when trying to use get_absolute_url in my template
> {{ post.get_absolute_url }} I get:
>
> Traceback (most recent call last):
[...]
> 245. self._urlconf_module = __import__(self.urlconf_name, {}, {},
> [''])
Although you give the traceback, you don't say what exception is raised.
So it's hard to guess.
A first step to debug this would be to try it at the interactive prompt
("manage.py shell") and see what happens when you call
get_absolute_url() on some model instances.
Regards,
Malcolm
--
I've got a mind like a... a... what's that thing called?
http://www.pointy-stick.com/blog/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---