Django

Code

Ticket #4103 (closed: fixed)

Opened 2 years ago

Last modified 1 year ago

Add "reverse" to url_dispatch documentation for named url patterns

Reported by: absoludity@gmail.com Assigned to: jacob
Milestone: Component: Documentation
Version: SVN Keywords: docs, url_dispatch
Cc: Triage Stage: Accepted
Has patch: 1 Needs documentation: 1
Needs tests: 0 Patch needs improvement: 0

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

url_dispatch.diff (1.6 kB) - added by Simon G. <dev@simon.net.nz> on 04/30/07 08:02:25.
url_dispatch2.diff (0.7 kB) - added by Simon G. <dev@simon.net.nz> on 04/30/07 08:03:45.

Change History

04/21/07 07:40:10 changed by Simon G. <dev@simon.net.nz>

  • needs_better_patch changed.
  • needs_tests changed.
  • summary changed from Addition to url_dispatch documentation for named url patterns to Add "reverse" to url_dispatch documentation for named url patterns.
  • keywords set to docs, url_dispatch.
  • needs_docs set to 1.
  • stage changed from Unreviewed to Accepted.

04/30/07 08:02:25 changed by Simon G. <dev@simon.net.nz>

  • attachment url_dispatch.diff added.

04/30/07 08:03:45 changed by Simon G. <dev@simon.net.nz>

  • attachment url_dispatch2.diff added.

04/30/07 08:04:28 changed by Simon G. <dev@simon.net.nz>

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).

04/30/07 08:04:45 changed by Simon G. <dev@simon.net.nz>

  • has_patch set to 1.

05/27/07 07:06:02 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to fixed.

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


Add/Change #4103 (Add "reverse" to url_dispatch documentation for named url patterns)




Change Properties
Action