Opened 17 years ago

Closed 17 years ago

#5702 closed (worksforme)

Django Documentation defect: missed 'name=' in - url_dispatch/#naming-url-patterns

Reported by: popt <popython@…> Owned by: nobody
Component: Documentation Version: dev
Severity: Keywords: Documentation
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Here’s the above example, rewritten to used named URL patterns:

urlpatterns = patterns('',
    url(r'/archive/(\d{4})/$', archive, name="full-archive"),
    url(r'/archive-summary/(\d{4})/$', archive, {'summary': True}, "arch-summary"),
)

it missed 'name=', should be:

Here’s the above example, rewritten to used named URL patterns:

urlpatterns = patterns('',
    url(r'/archive/(\d{4})/$', archive, name="full-archive"),
    url(r'/archive-summary/(\d{4})/$', archive, {'summary': True}, name="arch-summary"),
)

Attachments (1)

patch (248 bytes ) - added by popt <popython@…> 17 years ago.

Download all attachments as: .zip

Change History (2)

by popt <popython@…>, 17 years ago

Attachment: patch added

comment:1 by James Bennett, 17 years ago

Resolution: worksforme
Status: newclosed

The name argument isn't "keyword-only" (in fact, there's no such thing in Python currently); so long as it's fourth in the parameter list, it can be passed as a position argument like any other Python argment.

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