Code

Opened 7 years ago

Closed 7 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: master
Severity: Keywords: Documentation
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

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@…> 7 years ago.

Download all attachments as: .zip

Change History (2)

Changed 7 years ago by popt <popython@…>

comment:1 Changed 7 years ago by ubernostrum

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

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.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.