Code

Ticket #16570: 16570-3.diff

File 16570-3.diff, 3.6 KB (added by kenth, 2 years ago)

Updated patch to account for refactoring in #16681

Line 
1diff --git a/AUTHORS b/AUTHORS
2index b64a627..3e4d185 100644
3--- a/AUTHORS
4+++ b/AUTHORS
5@@ -525,7 +525,7 @@ answer newbie questions, and generally made Django that much better:
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>
14diff --git a/django/core/management/validation.py b/django/core/management/validation.py
15index 3cb2e34..3aaeaa9 100644
16--- a/django/core/management/validation.py
17+++ b/django/core/management/validation.py
18@@ -72,9 +72,9 @@ def get_validation_errors(outfile, app=None):
19                         mdigits_ok = True
20                 except (ValueError, TypeError):
21                     e.add(opts, mdigits_msg % f.name)
22-                invalid_values_msg = '"%s": DecimalFields require a "max_digits" attribute value that is greater than the value of the "decimal_places" attribute.'
23+                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.'
24                 if decimalp_ok and mdigits_ok:
25-                    if decimal_places >= max_digits:
26+                    if decimal_places > max_digits:
27                         e.add(opts, invalid_values_msg % f.name)
28             if isinstance(f, models.FileField) and not f.upload_to:
29                 e.add(opts, '"%s": FileFields require an "upload_to" attribute.' % f.name)
30diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
31index a5d66f8..e0cf92f 100644
32--- a/docs/ref/models/fields.txt
33+++ b/docs/ref/models/fields.txt
34@@ -450,7 +450,7 @@ A fixed-precision decimal number, represented in Python by a
35 .. attribute:: DecimalField.max_digits
36 
37     The maximum number of digits allowed in the number. Note that this number
38-    must be greater than ``decimal_places``, if it exists.
39+    must be greater than or equal to ``decimal_places``, if it exists.
40 
41 .. attribute:: DecimalField.decimal_places
42 
43diff --git a/tests/modeltests/invalid_models/invalid_models/models.py b/tests/modeltests/invalid_models/invalid_models/models.py
44index 422d70f..93c1c66 100644
45--- a/tests/modeltests/invalid_models/invalid_models/models.py
46+++ b/tests/modeltests/invalid_models/invalid_models/models.py
47@@ -243,8 +243,7 @@ invalid_models.fielderrors: "decimalfield2": DecimalFields require a "decimal_pl
48 invalid_models.fielderrors: "decimalfield2": DecimalFields require a "max_digits" attribute that is a positive integer.
49 invalid_models.fielderrors: "decimalfield3": DecimalFields require a "decimal_places" attribute that is a non-negative integer.
50 invalid_models.fielderrors: "decimalfield3": DecimalFields require a "max_digits" attribute that is a positive integer.
51-invalid_models.fielderrors: "decimalfield4": DecimalFields require a "max_digits" attribute value that is greater than the value of the "decimal_places" attribute.
52-invalid_models.fielderrors: "decimalfield5": DecimalFields require a "max_digits" attribute value that is greater than the value of the "decimal_places" attribute.
53+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.
54 invalid_models.fielderrors: "filefield": FileFields require an "upload_to" attribute.
55 invalid_models.fielderrors: "choices": "choices" should be iterable (e.g., a tuple or list).
56 invalid_models.fielderrors: "choices2": "choices" should be a sequence of two-tuples.