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 django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. 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/1e11369b-7bcb-432f-acb6-c3785328b642%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.