So, I've been trying to trace a bug that's been affecting me as well as
someone else I know, to do with ModelForms / the admin and CharFields
with null=True, blank=True, and unique=True

The old ticket for this was closed as WONTFIX:
http://code.djangoproject.com/ticket/9590

However, I'd personally rather see the admin work with this (more common
than you think) combination of options; otherwise, there's no way to
make more than one model with one of these fields via the admin, and
it's basically useless.

I'd propose we either ship a new CharField subclass (NullCharField,
perhaps), or add an option to the existing one, which when it gets
something in EMPTY_VALUES returns None, not u"". Then, modify ModelForm
(and thus the admin) to use this new subclass if the field has null=True
set.

It's a pretty simple fix, and I don't think it's an excessively ugly
thing to add one more option/subclass, especially when the resulting
error is quite user-unfriendly ("This value must be unique" error beside
a non-required, blank textbox).

Thoughts?

Andrew

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-develop...@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to