#4136: NULL fields and Unique keys -------------------------------------+------------------------------------- Reporter: David Cramer | Owner: <dcramer@…> | aashu_dwivedi Type: Bug | Status: assigned Component: Forms | Version: 1.3-rc Severity: Normal | Resolution: Keywords: | Triage Stage: Accepted Has patch: 1 | Needs documentation: 1 Needs tests: 1 | Patch needs improvement: 1 Easy pickings: 0 | UI/UX: 0 -------------------------------------+-------------------------------------
Comment (by msopacua): Replying to [comment:30 carljm]: > msopacua's suggestion is incomplete because it only considers the model- field API. Form fields don't even have a "blank" argument (they have "required"), so a different API would have to be proposed for them. Ultimately this is a form-field issue (we only need the option at model- field level to give a hint to modelform generation). I still think this is a model issue. For one, because the issue exists in translating model data to storage. Secondly, because I can think of a case, where the form would not present an empty string but the model might - like a bad word filter. For me the logical place to put such a thing would be in a model's clean(), but a case can be made to do this at the form level. > At the model-field level, my objection to msopacua's suggestion is that it implicitly applies to all field types (since they all have the `blank` option), but I think this issue is only relevant for `CharField`. True. I don't mind this being a charfield only option, if it gets picked up by custom fields that derive from it. You'd name it differently and only apply it to `CharField`.lll -- Ticket URL: <https://code.djangoproject.com/ticket/4136#comment:32> 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/090.d56de22dce6664a6577026db163eafb8%40djangoproject.com?hl=en. For more options, visit https://groups.google.com/groups/opt_out.