Code

Ticket #6092: 6092-docs.diff

File 6092-docs.diff, 3.0 KB (added by floguy, 7 years ago)

Adds documentation to my previous patch.

Line 
1Index: docs/newforms.txt
2===================================================================
3--- docs/newforms.txt   (revision 6819)
4+++ docs/newforms.txt   (working copy)
5@@ -1311,10 +1311,17 @@
6       moderately complex regular expression.
7     * Error message keys: ``required``, ``invalid``
8 
9-Has two optional arguments for validation, ``max_length`` and ``min_length``.
10-If provided, these arguments ensure that the string is at most or at least the
11-given length.
12 
13+Also takes the following optional arguments:
14+    ======================  =====================================================
15+    Argument                Description
16+    ======================  =====================================================
17+    ``max_length``          Ensures the string has at most this many characters.
18+    ``min_length``          Ensures the string has at least this many characters.
19+    ``pattern``             A compiled regex or string which will be used instead
20+                            of the default email validation regular expression.
21+    ======================  =====================================================
22+
23 ``FileField``
24 ~~~~~~~~~~~~~
25 
26@@ -1478,6 +1485,8 @@
27     ``validator_user_agent``  String used as the user-agent used when checking for
28                               a URL's existence. Defaults to the value of the
29                               ``URL_VALIDATOR_USER_AGENT`` setting.
30+    ``pattern``               A compiled regex or string which will be used instead
31+                              of the default url validation regular expression.
32     ========================  =====================================================
33 
34 Slightly complex built-in ``Field`` classes
35Index: docs/model-api.txt
36===================================================================
37--- docs/model-api.txt  (revision 6819)
38+++ docs/model-api.txt  (working copy)
39@@ -227,6 +227,9 @@
40 automatically set to 75. In the Django development version, ``max_length`` is
41 set to 75 by default, but you can specify it to override default behavior.
42 
43+It also accepts ``pattern``, which is a compiled regex or string which will be
44+used instead of the default email validation regular expression pattern.
45+
46 ``FileField``
47 ~~~~~~~~~~~~~
48 
49@@ -468,11 +471,14 @@
50 
51 The admin represents this as an ``<input type="text">`` (a single-line input).
52 
53-``URLField`` takes an optional argument, ``max_length``, the maximum length (in
54-characters) of the field. The maximum length is enforced at the database level and
55-in Django's validation. If you don't specify ``max_length``, a default of 200
56+``URLField`` takes two optional arguments.  The first is ``max_length``, the maximum
57+length (in characters) of the field. The maximum length is enforced at the database
58+level and in Django's validation. If you don't specify ``max_length``, a default of 200
59 is used.
60 
61+The second is ``pattern``, which is a compiled regex or string which will be used instead
62+of the default url validation regular expression pattern.
63+
64 ``USStateField``
65 ~~~~~~~~~~~~~~~~
66