Author: ubernostrum
Date: 2011-09-10 22:44:21 -0700 (Sat, 10 Sep 2011)
New Revision: 16811

Modified:
   django/trunk/docs/ref/models/instances.txt
   django/trunk/docs/topics/http/urls.txt
Log:
Fixed #16109: Corrected an inconsistency in URLconf examples for matching a 
numeric month.

Modified: django/trunk/docs/ref/models/instances.txt
===================================================================
--- django/trunk/docs/ref/models/instances.txt  2011-09-11 05:40:10 UTC (rev 
16810)
+++ django/trunk/docs/ref/models/instances.txt  2011-09-11 05:44:21 UTC (rev 
16811)
@@ -497,7 +497,7 @@
 
 Similarly, if you had a URLconf entry that looked like::
 
-    (r'/archive/(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/$', 
archive_view)
+    (r'/archive/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$', 
archive_view)
 
 ...you could reference this using ``permalink()`` as follows::
 
@@ -505,8 +505,8 @@
     def get_absolute_url(self):
         return ('archive_view', (), {
             'year': self.created.year,
-            'month': self.created.month,
-            'day': self.created.day})
+            'month': self.created.strftime('%m'),
+            'day': self.created.strftime('%d')})
 
 Notice that we specify an empty sequence for the second parameter in this case,
 because we only want to pass keyword parameters, not positional ones.

Modified: django/trunk/docs/topics/http/urls.txt
===================================================================
--- django/trunk/docs/topics/http/urls.txt      2011-09-11 05:40:10 UTC (rev 
16810)
+++ django/trunk/docs/topics/http/urls.txt      2011-09-11 05:44:21 UTC (rev 
16811)
@@ -109,8 +109,8 @@
     * ``/articles/2003`` would not match any of these patterns, because each
       pattern requires that the URL end with a slash.
 
-    * ``/articles/2003/03/3/`` would match the final pattern. Django would call
-      the function ``news.views.article_detail(request, '2003', '03', '3')``.
+    * ``/articles/2003/03/03/`` would match the final pattern. Django would 
call
+      the function ``news.views.article_detail(request, '2003', '03', '03')``.
 
 .. _Dive Into Python's explanation: 
http://diveintopython.org/regular_expressions/street_addresses.html#re.matching.2.3
 
@@ -133,7 +133,7 @@
         (r'^articles/2003/$', 'news.views.special_case_2003'),
         (r'^articles/(?P<year>\d{4})/$', 'news.views.year_archive'),
         (r'^articles/(?P<year>\d{4})/(?P<month>\d{2})/$', 
'news.views.month_archive'),
-        (r'^articles/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d+)/$', 
'news.views.article_detail'),
+        (r'^articles/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$', 
'news.views.article_detail'),
     )
 
 This accomplishes exactly the same thing as the previous example, with one
@@ -144,8 +144,8 @@
       ``news.views.month_archive(request, year='2005', month='03')``, instead
       of ``news.views.month_archive(request, '2005', '03')``.
 
-    * A request to ``/articles/2003/03/3/`` would call the function
-      ``news.views.article_detail(request, year='2003', month='03', day='3')``.
+    * A request to ``/articles/2003/03/03/`` would call the function
+      ``news.views.article_detail(request, year='2003', month='03', 
day='03')``.
 
 In practice, this means your URLconfs are slightly more explicit and less prone
 to argument-order bugs -- and you can reorder the arguments in your views'

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to