Ticket #16570: 16570.diff

File 16570.diff, 2.9 KB (added by Dan Watson, 13 years ago)

Patch against trunk r16579, all tests pass.

  • AUTHORS

     
    517517    wam-djangobug@wamber.net
    518518    Wang Chun <wangchun@exoweb.net>
    519519    Filip Wasilewski <filip.wasilewski@gmail.com>
    520     Dan Watson <http://theidioteque.net/>
     520    Dan Watson <http://danwatson.net/>
    521521    Joel Watts <joel@joelwatts.com>
    522522    Lakin Wecker <lakin@structuredabstraction.com>
    523523    Chris Wesseling <Chris.Wesseling@cwi.nl>
  • django/core/management/validation.py

     
    6666                        mdigits_ok = True
    6767                except (ValueError, TypeError):
    6868                    e.add(opts, mdigits_msg % f.name)
    69                 invalid_values_msg = '"%s": DecimalFields require a "max_digits" attribute value that is greater than the value of the "decimal_places" attribute.'
     69                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.'
    7070                if decimalp_ok and mdigits_ok:
    71                     if decimal_places >= max_digits:
     71                    if decimal_places > max_digits:
    7272                        e.add(opts, invalid_values_msg % f.name)
    7373            if isinstance(f, models.FileField) and not f.upload_to:
    7474                e.add(opts, '"%s": FileFields require an "upload_to" attribute.' % f.name)
  • tests/modeltests/invalid_models/models.py

     
    227227invalid_models.fielderrors: "decimalfield2": DecimalFields require a "max_digits" attribute that is a positive integer.
    228228invalid_models.fielderrors: "decimalfield3": DecimalFields require a "decimal_places" attribute that is a non-negative integer.
    229229invalid_models.fielderrors: "decimalfield3": DecimalFields require a "max_digits" attribute that is a positive integer.
    230 invalid_models.fielderrors: "decimalfield4": DecimalFields require a "max_digits" attribute value that is greater than the value of the "decimal_places" attribute.
    231 invalid_models.fielderrors: "decimalfield5": DecimalFields require a "max_digits" attribute value that is greater than the value of the "decimal_places" attribute.
     230invalid_models.fielderrors: "decimalfield4": DecimalFields require a "max_digits" attribute value that is greater than or equal to the value of the "decimal_places" attribute.
    232231invalid_models.fielderrors: "filefield": FileFields require an "upload_to" attribute.
    233232invalid_models.fielderrors: "choices": "choices" should be iterable (e.g., a tuple or list).
    234233invalid_models.fielderrors: "choices2": "choices" should be a sequence of two-tuples.
Back to Top