瀏覽代碼

Documented url()'s 'regex' parameter.

Adam Chainz 8 年之前
父節點
當前提交
0a9bd266ff
共有 2 個文件被更改,包括 8 次插入0 次删除
  1. 7 0
      docs/ref/urls.txt
  2. 1 0
      docs/topics/i18n/translation.txt

+ 7 - 0
docs/ref/urls.txt

@@ -33,6 +33,13 @@ Helper function to return a URL pattern for serving files in debug mode::
         ...
     ]
 
+The ``regex`` parameter should be a string or
+:func:`~django.utils.translation.ugettext_lazy()` (see
+:ref:`translating-urlpatterns`) that contains a regular expression compatible
+with Python's :py:mod:`re` module. Strings typically use raw string syntax
+(``r''``) so that they can contain sequences like ``\d`` without the need to
+escape the backslash with another backslash.
+
 The ``view`` parameter is a view function or the result of
 :meth:`~django.views.generic.base.View.as_view` for class-based views. It can
 also be an :func:`include`.

+ 1 - 0
docs/topics/i18n/translation.txt

@@ -1533,6 +1533,7 @@ will be::
     Ensure that you don't have non-prefixed URL patterns that might collide
     with an automatically-added language prefix.
 
+.. _translating-urlpatterns:
 
 Translating URL patterns
 ------------------------