Completely lost on this... I'm trying to set up permalinks to my
articles, which are using generic views. I've gotten it to work by
hard coding the url path into the get_absolute_url function, but I'd
like it to be based off the url defined in the view (http://
docs.djangoproject.com/en/dev/ref/models/instances/?from=olddocs#the-
permalink-decorator).


[from urls.py]

news_dict = {
        'queryset' : Article.objects.all(),
        'date_field' : 'pub_date',
}

urlpatterns = patterns('django.views.generic.date_based',
    url(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/(?P<day>\w{1,2})/(?
P<slug>.*)/$', 'object_detail', dict(news_dict, slug_field='slug'),
name='article_view'),
)



[from models.py]

    @models.permalink
    def get_absolute_url(self):
        return ('article_view', (), {
            'year': self.pub_date.strftime('%Y'),
            'month': self.pub_date.strftime('%b').lower(),
            'day': self.pub_date.strftime('%d')
            })
        get_absolute_url = permalink(get_absolute_url)


Whenever I call get_absolute_url, all it returns is an empty string -
with no indication of what went wrong. Any ideas on this? I don't see
how my code's any different from the docs...
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to