Opened 14 years ago
Closed 14 years ago
#14088 closed (invalid)
Possible typo in Tutorial page #4
Reported by: | Dustin Farris | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | dev |
Severity: | Keywords: | Dev Tutorial | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
Following the introductory tutorial:
http://docs.djangoproject.com/en/dev/intro/tutorial04/#intro-tutorial04
The example showing the view()
function calls the reverse()
function passing a tuple as the "args" argument. This seemed to generate the following error from Django:
"reverse() argument after * must be a sequence, not long"
Fiddling with the code, I realized that reverse() seemed to expect a list for "args", not a tuple. Changing the code to ... , args=[p.id]))
cleared the error.
Note:
See TracTickets
for help on using tickets.
Sounds like you did not include the trailing comma in the tuple. Note the doc has, for example:
The comma after
p.id
is required for the single-element tuple to be recognized by Python as a tuple, and thus a sequence. This is a standard Python gotcha, see: http://wiki.python.org/moin/TupleSyntax.(If the trailing comma is missing some place on that page, please point it out exactly; I'm not seeing any missing commas for the args to reverse.)