#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: 0 Needs tests: 0 | UI/UX: 0 Easy pickings: 0 | -------------------------------------+-------------------------------------
Comment (by aaugustin): A quick look at the code shows that DecimalField and FloatField probably suffer from the same issue. I'd like to fix it for all numeric fields. Since [4cccb85e] it's possible to customize `empty_values` per field. However, I'm not sure that feature was introduced for this use case. It appears to be targeted at custom fields (judging by the tests introduced in that commit). Maybe Claude could confirm. Besides, `IntegerField` already has `empty_strings_allowed = False`. Removing the empty string from `empty_values` appears to duplicate this information. So I really doubt it's the right fix. If we step back, the root cause it's Django's historical lack of model- level validation. Unfortunately I don't know the entire story. I'm just mentioning it in case it helps finding a patch consistent with the existing code. -- Ticket URL: <https://code.djangoproject.com/ticket/20205#comment:15> 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.436b2d207fa7df4bef4fd5e574397a9e%40djangoproject.com?hl=en. For more options, visit https://groups.google.com/groups/opt_out.