I am writing to see if anyone thinks this is not a bug before creating
a new ticket. I have an app that runs as expected on Django 1.1.1. It
used to work on the development version, but a problem arose no later
than 1.2 alpha 1 SVN-12271, and perhaps much earlier.

Basically, the errors dictionary is wrong for every CharField with
choices in the model. My custom validation continues to work, except
when overridden by default validation. When my custom validation is
commented out, the picture becomes clearer:

1)  An error "Value u"A325" is not a valid choice" is reported for a
select field with no possibility of selecting a blank when any of the
four available choices is selected. Elimination of the "blank" line is
handled as described on 11/07/07 by semenov at 
http://code.djangoproject.com/ticket/4653
using a combination of an explicit blank=False and a declared default
value. This is baffling. I cannot conceive of a reason for an error in
this case.

2) An error of "This field cannot be blank" is reported for fields
with a default named in the model, such as:

stiff_pl_grade    = models.CharField(max_length=8, choices=PL_grades,
blank=False, default="A36",
    help_text="Stiffener PL grade")

It is my understanding that if a default is supplied, it should not be
necessary to fill the field, even if blank=False.

FloatFields with choices and IntegerFields with choices continue to
behave as expected.

It seems clear that when the is_valid() method is run on the form,
something bad is happening to CharFields with choices, and this type
of field only, and perfectly valid string selections or string
defaults are being reported as invalid, probably by automatic model
validation.

My code works fine under version 1.1.1 and I see nothing in the
development documentation to explain this odd new behavior.

Any thoughts?

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

Reply via email to