Also of note, I recently upgraded to Django 1.9 from Django 1.7 where this 
was working fine. It looks like this commit is the cause of my problem:
https://github.com/django/django/commit/ff077cd6496b6f82195e2dc040f70e19e7c206c9

On Tuesday, January 19, 2016 at 4:23:00 PM UTC-8, steve byerly wrote:
>
> I have a model with a nullable field (PositiveSmallIntegerField) with 
> defined choices. When I make a ModelForm for the model and do not select a 
> value for this field, the field always comes back in the changed data. The 
> reason is that the empty choice value, the data_value, is an empty string, 
> while the initial_value is None.
>
> I can override the base field and make a TypedChoiceField, and provide a 
> function to coerce which returns None if the value is an empty string.
>
> Is this the only route, or is there a better way to accomplish this?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/6c38874b-b876-43a5-827b-fcf8d48365cf%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to