Code

Ticket #16570: 16570-2.diff

File 16570-2.diff, 3.5 KB (added by dcwatson, 3 years ago)

Updated with documentation patch

Line 
1Index: AUTHORS
2===================================================================
3--- AUTHORS     (revision 16579)
4+++ AUTHORS     (working copy)
5@@ -517,7 +517,7 @@
6     wam-djangobug@wamber.net
7     Wang Chun <wangchun@exoweb.net>
8     Filip Wasilewski <filip.wasilewski@gmail.com>
9-    Dan Watson <http://theidioteque.net/>
10+    Dan Watson <http://danwatson.net/>
11     Joel Watts <joel@joelwatts.com>
12     Lakin Wecker <lakin@structuredabstraction.com>
13     Chris Wesseling <Chris.Wesseling@cwi.nl>
14Index: docs/ref/models/fields.txt
15===================================================================
16--- docs/ref/models/fields.txt  (revision 16579)
17+++ docs/ref/models/fields.txt  (working copy)
18@@ -450,7 +450,7 @@
19 .. attribute:: DecimalField.max_digits
20 
21     The maximum number of digits allowed in the number. Note that this number
22-    must be greater than ``decimal_places``, if it exists.
23+    must be greater than or equal to ``decimal_places``, if it exists.
24 
25 .. attribute:: DecimalField.decimal_places
26 
27Index: tests/modeltests/invalid_models/models.py
28===================================================================
29--- tests/modeltests/invalid_models/models.py   (revision 16579)
30+++ tests/modeltests/invalid_models/models.py   (working copy)
31@@ -227,8 +227,7 @@
32 invalid_models.fielderrors: "decimalfield2": DecimalFields require a "max_digits" attribute that is a positive integer.
33 invalid_models.fielderrors: "decimalfield3": DecimalFields require a "decimal_places" attribute that is a non-negative integer.
34 invalid_models.fielderrors: "decimalfield3": DecimalFields require a "max_digits" attribute that is a positive integer.
35-invalid_models.fielderrors: "decimalfield4": DecimalFields require a "max_digits" attribute value that is greater than the value of the "decimal_places" attribute.
36-invalid_models.fielderrors: "decimalfield5": DecimalFields require a "max_digits" attribute value that is greater than the value of the "decimal_places" attribute.
37+invalid_models.fielderrors: "decimalfield4": DecimalFields require a "max_digits" attribute value that is greater than or equal to the value of the "decimal_places" attribute.
38 invalid_models.fielderrors: "filefield": FileFields require an "upload_to" attribute.
39 invalid_models.fielderrors: "choices": "choices" should be iterable (e.g., a tuple or list).
40 invalid_models.fielderrors: "choices2": "choices" should be a sequence of two-tuples.
41Index: django/core/management/validation.py
42===================================================================
43--- django/core/management/validation.py        (revision 16579)
44+++ django/core/management/validation.py        (working copy)
45@@ -66,9 +66,9 @@
46                         mdigits_ok = True
47                 except (ValueError, TypeError):
48                     e.add(opts, mdigits_msg % f.name)
49-                invalid_values_msg = '"%s": DecimalFields require a "max_digits" attribute value that is greater than the value of the "decimal_places" attribute.'
50+                invalid_values_msg = '"%s": DecimalFields require a "max_digits" attribute value that is greater than or equal to the value of the "decimal_places" attribute.'
51                 if decimalp_ok and mdigits_ok:
52-                    if decimal_places >= max_digits:
53+                    if decimal_places > max_digits:
54                         e.add(opts, invalid_values_msg % f.name)
55             if isinstance(f, models.FileField) and not f.upload_to:
56                 e.add(opts, '"%s": FileFields require an "upload_to" attribute.' % f.name)