diff options
| author | chriscauley <chris@lablackey.com> | 2014-04-14 14:12:44 -0400 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2014-04-16 20:36:29 -0400 |
| commit | 66ec9ee441618894c1ccebdcdd5eb4d7fbf4a6d3 (patch) | |
| tree | 956a7d4f6e3b1c348505a3f2d23c7813c6c362b8 /docs/ref | |
| parent | 030dd4f72ca4d84c0a5e09ee625123d03651fdd1 (diff) | |
Fixed #22378 -- Updated \d to [0-9]+ in urlpatterns of docs and tests.
Thanks tomwys for the suggestion.
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/class-based-views/base.txt | 4 | ||||
| -rw-r--r-- | docs/ref/class-based-views/generic-date-based.txt | 12 | ||||
| -rw-r--r-- | docs/ref/contrib/syndication.txt | 2 | ||||
| -rw-r--r-- | docs/ref/forms/fields.txt | 6 | ||||
| -rw-r--r-- | docs/ref/models/instances.txt | 6 | ||||
| -rw-r--r-- | docs/ref/templates/builtins.txt | 2 | ||||
| -rw-r--r-- | docs/ref/urls.txt | 12 |
7 files changed, 22 insertions, 22 deletions
diff --git a/docs/ref/class-based-views/base.txt b/docs/ref/class-based-views/base.txt index e8f5271e97..0e43f5b4b3 100644 --- a/docs/ref/class-based-views/base.txt +++ b/docs/ref/class-based-views/base.txt @@ -198,8 +198,8 @@ RedirectView from article.views import ArticleCounterRedirectView, ArticleDetail urlpatterns = [ - url(r'^counter/(?P<pk>\d+)/$', ArticleCounterRedirectView.as_view(), name='article-counter'), - url(r'^details/(?P<pk>\d+)/$', ArticleDetail.as_view(), name='article-detail'), + url(r'^counter/(?P<pk>[0-9]+)/$', ArticleCounterRedirectView.as_view(), name='article-counter'), + url(r'^details/(?P<pk>[0-9]+)/$', ArticleDetail.as_view(), name='article-detail'), url(r'^go-to-django/$', RedirectView.as_view(url='http://djangoproject.com'), name='go-to-django'), ] diff --git a/docs/ref/class-based-views/generic-date-based.txt b/docs/ref/class-based-views/generic-date-based.txt index 9d6d447052..ecaeddfecc 100644 --- a/docs/ref/class-based-views/generic-date-based.txt +++ b/docs/ref/class-based-views/generic-date-based.txt @@ -171,7 +171,7 @@ YearArchiveView from myapp.views import ArticleYearArchiveView urlpatterns = [ - url(r'^(?P<year>\d{4})/$', + url(r'^(?P<year>[0-9]{4})/$', ArticleYearArchiveView.as_view(), name="article_year_archive"), ] @@ -267,11 +267,11 @@ MonthArchiveView urlpatterns = [ # Example: /2012/aug/ - url(r'^(?P<year>\d{4})/(?P<month>[-\w]+)/$', + url(r'^(?P<year>[0-9]{4})/(?P<month>[-\w]+)/$', ArticleMonthArchiveView.as_view(), name="archive_month"), # Example: /2012/08/ - url(r'^(?P<year>\d{4})/(?P<month>\d+)/$', + url(r'^(?P<year>[0-9]{4})/(?P<month>[0-9]+)/$', ArticleMonthArchiveView.as_view(month_format='%m'), name="archive_month_numeric"), ] @@ -361,7 +361,7 @@ WeekArchiveView urlpatterns = [ # Example: /2012/week/23/ - url(r'^(?P<year>\d{4})/week/(?P<week>\d+)/$', + url(r'^(?P<year>[0-9]{4})/week/(?P<week>[0-9]+)/$', ArticleWeekArchiveView.as_view(), name="archive_week"), ] @@ -475,7 +475,7 @@ DayArchiveView urlpatterns = [ # Example: /2012/nov/10/ - url(r'^(?P<year>\d{4})/(?P<month>[-\w]+)/(?P<day>\d+)/$', + url(r'^(?P<year>[0-9]{4})/(?P<month>[-\w]+)/(?P<day>[0-9]+)/$', ArticleDayArchiveView.as_view(), name="archive_day"), ] @@ -597,7 +597,7 @@ DateDetailView from django.views.generic.dates import DateDetailView urlpatterns = [ - url(r'^(?P<year>\d+)/(?P<month>[-\w]+)/(?P<day>\d+)/(?P<pk>\d+)/$', + url(r'^(?P<year>[0-9]+)/(?P<month>[-\w]+)/(?P<day>[0-9]+)/(?P<pk>[0-9]+)/$', DateDetailView.as_view(model=Article, date_field="pub_date"), name="archive_date_detail"), ] diff --git a/docs/ref/contrib/syndication.txt b/docs/ref/contrib/syndication.txt index b2ebf40e61..3310edd343 100644 --- a/docs/ref/contrib/syndication.txt +++ b/docs/ref/contrib/syndication.txt @@ -217,7 +217,7 @@ The police beat feeds could be accessible via URLs like this: These can be matched with a :doc:`URLconf </topics/http/urls>` line such as:: - (r'^beats/(?P<beat_id>\d+)/rss/$', BeatFeed()), + (r'^beats/(?P<beat_id>[0-9]+)/rss/$', BeatFeed()), Like a view, the arguments in the URL are passed to the ``get_object()`` method along with the request object. diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt index 10547a1664..ec9ea3a85e 100644 --- a/docs/ref/forms/fields.txt +++ b/docs/ref/forms/fields.txt @@ -930,10 +930,10 @@ Slightly complex built-in ``Field`` classes # Or define a different message for each field. fields = ( CharField(error_messages={'incomplete': 'Enter a country code.'}, - validators=[RegexValidator(r'^\d+$', 'Enter a valid country code.')]), + validators=[RegexValidator(r'^[0-9]+$', 'Enter a valid country code.')]), CharField(error_messages={'incomplete': 'Enter a phone number.'}, - validators=[RegexValidator(r'^\d+$', 'Enter a valid phone number.')]), - CharField(validators=[RegexValidator(r'^\d+$', 'Enter a valid extension.')], + validators=[RegexValidator(r'^[0-9]+$', 'Enter a valid phone number.')]), + CharField(validators=[RegexValidator(r'^[0-9]+$', 'Enter a valid extension.')], required=False), ) super(PhoneField, self).__init__( diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt index 2a93996d8d..9bc7b841c7 100644 --- a/docs/ref/models/instances.txt +++ b/docs/ref/models/instances.txt @@ -642,7 +642,7 @@ template tag and a high-level wrapper for the An example should make it clear how to use ``permalink()``. Suppose your URLconf contains a line such as:: - (r'^people/(\d+)/$', 'people.views.details'), + (r'^people/([0-9]+)/$', 'people.views.details'), ...your model could have a :meth:`~django.db.models.Model.get_absolute_url` method that looked like this:: @@ -655,7 +655,7 @@ method that looked like this:: Similarly, if you had a URLconf entry that looked like:: - (r'/archive/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/$', archive_view) + (r'/archive/(?P<year>[0-9]{4})/(?P<month>[0-9]{2})/(?P<day>[0-9]{2})/$', archive_view) ...you could reference this using ``permalink()`` as follows:: @@ -684,7 +684,7 @@ pattern tuple by a call to the ``url`` function):: from django.conf.urls import url - url(r'^people/(\d+)/$', 'blog_views.generic_detail', name='people_view'), + url(r'^people/([0-9]+)/$', 'blog_views.generic_detail', name='people_view'), ...and then using that name to perform the reverse URL resolution instead of the view name:: diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index 6e9c703938..a78fd49548 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -1000,7 +1000,7 @@ takes a client ID (here, ``client()`` is a method inside the views file .. code-block:: python - ('^client/(\d+)/$', 'app_views.client') + ('^client/([0-9]+)/$', 'app_views.client') If this app's URLconf is included into the project's URLconf under a path such as this: diff --git a/docs/ref/urls.txt b/docs/ref/urls.txt index 47ef488afc..be09777b40 100644 --- a/docs/ref/urls.txt +++ b/docs/ref/urls.txt @@ -23,9 +23,9 @@ URLconf from the :doc:`Django overview </intro/overview>`:: from django.conf.urls import patterns, url urlpatterns = patterns('', - url(r'^articles/(\d{4})/$', 'news.views.year_archive'), - url(r'^articles/(\d{4})/(\d{2})/$', 'news.views.month_archive'), - url(r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'news.views.article_detail'), + url(r'^articles/([0-9]{4})/$', 'news.views.year_archive'), + url(r'^articles/([0-9]{4})/([0-9]{2})/$', 'news.views.month_archive'), + url(r'^articles/([0-9]{4})/([0-9]{2})/([0-9]+)/$', 'news.views.article_detail'), ) In this example, each view has a common prefix -- ``'news.views'``. @@ -38,9 +38,9 @@ With this in mind, the above example can be written more concisely as:: from django.conf.urls import patterns, url urlpatterns = patterns('news.views', - url(r'^articles/(\d{4})/$', 'year_archive'), - url(r'^articles/(\d{4})/(\d{2})/$', 'month_archive'), - url(r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'article_detail'), + url(r'^articles/([0-9]{4})/$', 'year_archive'), + url(r'^articles/([0-9]{4})/([0-9]{2})/$', 'month_archive'), + url(r'^articles/([0-9]{4})/([0-9]{2})/([0-9]+)/$', 'article_detail'), ) Note that you don't put a trailing dot (``"."``) in the prefix. Django puts |
