#20205: PositiveIntegerfield does not handle empty values well -------------------------------------+------------------------------------- Reporter: anonymous | Owner: AmiZya Type: Bug | Status: assigned Component: Database layer | Version: master (models, ORM) | Resolution: Severity: Normal | Triage Stage: Accepted Keywords: | Needs documentation: 0 Has patch: 1 | Patch needs improvement: 1 Needs tests: 0 | UI/UX: 0 Easy pickings: 0 | -------------------------------------+-------------------------------------
Comment (by loic84): [4cccb85e] was indeed designed with custom fields in mind, but using it is the right way of addressing this issue. Ideally each field would define exactly what values it considers empty rather than using the historical blanket `EMPTY_VALUES = (None, '', [], (), {})`. After all `{}` would hardly make sense for a numerical field, yet it would pass validation. For the record, there is a tricky issue where a value of `None` when `is_null=False` would pass validation only to burst upon saving. I've tried to address that but it turned out to be almost impossible without making significant incompatible changes. Also some people on IRC voiced their concerns that None/null is a database concept and that they don't want validation to mess with it, a few core dev however agreed that it should be fixed if possible. -- Ticket URL: <https://code.djangoproject.com/ticket/20205#comment:18> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.26d3eb67c93ca2c94164603c5f348920%40djangoproject.com. For more options, visit https://groups.google.com/groups/opt_out.