Opened 8 years ago

Closed 8 years ago

#4103 closed (fixed)

Add "reverse" to url_dispatch documentation for named url patterns

Reported by: absoludity@… Owned by: jacob
Component: Documentation Version: master
Severity: Keywords: docs, url_dispatch
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Just a small addition to the documentation for accessing named URL patterns at:

http://www.djangoproject.com/documentation/url_dispatch/#naming-url-patterns

See email exchange between myself and Malcolm below...

On Sat, 2007-04-21 at 01:47 -0700, Michael wrote:

I'm not sure if this is obvious, but the documentation at:

http://www.djangoproject.com/documentation/url_dispatch/#naming-url-patterns

doesn't mention how you can use your named URL patters to redirect
from one view to another. It only shows how you can get the url for a
view from within a template.

Anyways, turns out to be pretty simple (found it in the source
django_src/django/template/defaulttags.py):

from django.core.urlresolvers import reverse
return HttpResponseRedirect( reverse( 'your-url-name' ) )

Have I missed something and this was documented else where? Otherwise
I'll raise a ticket to update the above documentation for named url
patterns...

We haven't documented reverse() anywhere, as far as I know. So worth
filing a ticket.

Thanks,
Malcolm

Attachments (2)

url_dispatch.diff (1.6 KB) - added by Simon G. <dev@…> 8 years ago.
url_dispatch2.diff (733 bytes) - added by Simon G. <dev@…> 8 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 Changed 8 years ago by Simon G. <dev@…>

  • Keywords docs url_dispatch added
  • Needs documentation set
  • Needs tests unset
  • Patch needs improvement unset
  • Summary changed from Addition to url_dispatch documentation for named url patterns to Add "reverse" to url_dispatch documentation for named url patterns
  • Triage Stage changed from Unreviewed to Accepted

Changed 8 years ago by Simon G. <dev@…>

Changed 8 years ago by Simon G. <dev@…>

comment:2 Changed 8 years ago by Simon G. <dev@…>

Here's a first attempt - what else needs to be commented? (take the second patch, the first has some crud in there from something else).

comment:3 Changed 8 years ago by Simon G. <dev@…>

  • Has patch set

comment:4 Changed 8 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

(In [5362]) Added documentation for reverse() (based on a patch from Simon Greenhill) and
another cross-reference to permalink(). Fixed #4103.

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