#28627: path-urls documentation implies implicit converter-types
------------------------------------------------+------------------------
Reporter: Christopher Schäpers | Owner: nobody
Type: Uncategorized | Status: new
Component: Documentation | Version: 2.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
The documentation for the new path() urls somewhat implies that if you
have a named value in an url without a converter type, but with the name
of a converter-type it takes the name of the value, and uses it as its
converter-type.
E.g.
{{{
path('articles/<slug>/', …)
}}}
would only match a slug, and would pass the value on as "slug".
(As seen here:
https://docs.djangoproject.com/en/dev/topics/http/urls/#example )
This is wrong, as mentioned below (easy to miss, if you're eager to test
stuff out):
{{{
If a converter isn’t included, any string, excluding a / character, is
matched.
}}}
----
However it doesn't help, that the example uses "slug" as a name, and
states
{{{
/articles/2003/03/building-a-django-site/
}}}
would match the last example, even though
{{{
/articles/2003/03/building+a~django@site/
}}}
would match it just as well.
----
Simple fix would be to just change the example from
{{{
articles/<int:year>/<int:month>/<slug>/
}}}
to
{{{
articles/<int:year>/<int:month>/<slug:slug>/
}}}
because I suppose the implicit converter types aren't a feature of 2.0.
(If someone points me to the right repo, I can do the little documentation
change myself)
--
Ticket URL: <https://code.djangoproject.com/ticket/28627>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.9f022319f6e11948b28e58bf826ed4fe%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.