Hi! We've recently hit upon a problem where we need empty strings in a CharField to be coerced to NULL. Obviously nullable CharField's are frowned upon but we have the requirement that non-empty values must be unique, so the empty state must be NULL.
We've written a custom subclass of CharField to deal with this, but when I found the bug report[1] for this issue, the wontfix justification was that it would make things backwards incompatible. What I'm proposing instead is we add another option to CharField's __init__ which defaults to true called "allow_empty_strings". If set to False, and the field is nullable, this would coerce empty values to None. If the field was not nullable, this would raise an exception (ValueError?, IntegrityError?). Is this an acceptable solution to support this use-case? Thanks, Luke. [1] https://code.djangoproject.com/ticket/9590 -- You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscr...@googlegroups.com. To post to this group, send email to django-developers@googlegroups.com. Visit this group at https://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/ad3d155c-6386-4d4f-a4f3-07544c2f127e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.