Skip to content

Commit

Permalink
Fixed get_absolute_url() for comments. Previously, it relied on "view…
Browse files Browse the repository at this point in the history
… on site"

for admin being reversible or required people to set up their own version. Now
we ship a default pattern in the comments URLs in a way that is unlikely to
clash with anything else.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8614 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
malcolmt committed Aug 27, 2008
1 parent 157dbe2 commit c305471
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions django/contrib/comments/models.py
Expand Up @@ -30,11 +30,10 @@ class Meta:


def get_content_object_url(self): def get_content_object_url(self):
""" """
Get a URL suitable for redirecting to the content object. Uses the Get a URL suitable for redirecting to the content object.
``django.views.defaults.shortcut`` view, which thus must be installed.
""" """
return urlresolvers.reverse( return urlresolvers.reverse(
"django.views.defaults.shortcut", "comments-url-redirect",
args=(self.content_type_id, self.object_pk) args=(self.content_type_id, self.object_pk)
) )


Expand Down
4 changes: 4 additions & 0 deletions django/contrib/comments/urls.py
Expand Up @@ -13,3 +13,7 @@
url(r'^approved/$', 'moderation.approve_done', name='comments-approve-done'), url(r'^approved/$', 'moderation.approve_done', name='comments-approve-done'),
) )


urlpatterns += patterns('',
url(r'^cr/(\d+)/(\w+)/$', 'django.views.defaults.shortcut', name='comments-url-redirect'),
)

0 comments on commit c305471

Please sign in to comment.