Opened 16 years ago

Closed 16 years ago

Last modified 5 years ago

#8559 closed (fixed)

new comment.get_absolute_url returns ''

Reported by: TrevorFSmith Owned by: nobody
Component: Documentation Version: dev
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Just upgraded to the new comments system (sort of peaved that headlines went away, but hey) and {{ comment.get_absolute_url }} now returns . I can get comment.content_object.get_absolute_url with no problem.

Change History (3)

comment:1 by TrevorFSmith, 16 years ago

More info: when I call comment.get_absolute_url() from view.py I receive an exception:

Traceback (most recent call last):
  File "/Users/trevor/Crosscut/Code/yesler/news/views.py", line 366, in story_detail
    return HttpResponseRedirect(comment.get_absolute_url())
  File "/Library/Python/2.5/site-packages/django/utils/functional.py", line 55, in _curried
    return _curried_func(*(args+moreargs), **dict(kwargs, **morekwargs))
  File "/Library/Python/2.5/site-packages/django/db/models/base.py", line 488, in get_absolute_url
    return settings.ABSOLUTE_URL_OVERRIDES.get('%s.%s' % (opts.app_label, opts.module_name), func)(self, *args, **kwargs)
  File "/Library/Python/2.5/site-packages/django/contrib/comments/models.py", line 136, in get_absolute_url
    return self.get_content_object_url() + (anchor_pattern % self.__dict__)
  File "/Library/Python/2.5/site-packages/django/contrib/comments/models.py", line 38, in get_content_object_url
    args=(self.content_type_id, self.object_pk)
  File "/Library/Python/2.5/site-packages/django/core/urlresolvers.py", line 307, in reverse
    *args, **kwargs)))
  File "/Library/Python/2.5/site-packages/django/core/urlresolvers.py", line 291, in reverse
    raise NoReverseMatch("Reverse for '%s' not found." % lookup_view)
NoReverseMatch: Reverse for '<function shortcut at 0x15c23b0>' not found.

comment:2 by Jacob, 16 years ago

Component: django.contrib.commentsDocumentation
Triage Stage: UnreviewedAccepted

That's because the shortcut view isn't installed; you'll need to make sure that django.views.defaults.shortcut is installed somewhere for that to work. This should be documented better.

There's not much to be done to fix it generically, however. -- there's no comment detail view.

in reply to:  2 comment:3 by Thejaswi Puthraya, 16 years ago

Resolution: fixed
Status: newclosed

Replying to jacob:

That's because the shortcut view isn't installed; you'll need to make sure that django.views.defaults.shortcut is installed somewhere for that to work. This should be documented better.

There's not much to be done to fix it generically, however. -- there's no comment detail view.

Jacob, looks like there will be no necessity to document it. Malcolm has fixed it in [8614]. Thanks to Malcolm for the patch and TrevorFSmith and others (on #django-dev and IRC) for reporting this issue.

Note: See TracTickets for help on using tickets.
Back to Top