django的get_absolute_url,还是挺有用的。 参考[这里](http://docs.djangoproject.com/en/dev/ref/models/instances/#get- absolute-url)

from django.db import models

@models.permalink
def get_absolute_url(self):
    return ('people.views.details', [str(self.id)])

Or:

(r'/archive/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/$', archive_view)



@models.permalink
def get_absolute_url(self):
    return ('archive_view', (), {
        'year': self.created.year,
        'month': self.created.month,
        'day': self.created.day})