#16109 closed Bug (fixed)
Inconsistency in docs: Leading zero of numbers in URLconf
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Documentation | Version: | 1.3 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In https://docs.djangoproject.com/en/1.3/topics/http/urls/#example, the suggested regex for an article / numbers in a url is
r'^articles/(\d{4})/(\d{2})/(\d+)/$'
But in https://docs.djangoproject.com/en/1.3/ref/models/instances/#django.db.models.permalink, it says
r'/archive/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/$'
In particular, the first expression allows only 05 for a month, the second 05 and 5, which leads to multiple urls for the same content. Additionally, the example get_absolute_url method wouldn't match the first expression (\d{2}) for dates with month or day below 10.
I first thought this is a "support issue", not a bug, so you may want to read my post on stackoverflow.com. It was recommended to me to submit bug report because of this inconsistency in the docs.
Attachments (1)
Change History (7)
comment:1 by , 13 years ago
Triage Stage: | Unreviewed → Accepted |
---|
comment:2 by , 13 years ago
Type: | Uncategorized → Bug |
---|---|
UI/UX: | unset |
by , 13 years ago
Attachment: | 16109.diff added |
---|
comment:3 by , 13 years ago
Has patch: | set |
---|
Patched the docs to not have any ambiguous date urls (so no d{1,2}).
comment:4 by , 13 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
patch applies cleanly and text makes sense
Rather minor, but why not.