Hi,
The following snippet demonstrates the issue:
class BooleanModel(db.Model):
bool_prop = db.BooleanProperty(required=True, default=True)
class BooleanModelForm(djangoforms.ModelForm):
class Meta:
model = BooleanModel
view:
def bool_form(request):
if request.method == "POST":
f = BooleanModelForm(request.POST)
if f.is_valid():
return HttpResponseRedirect("http://www.google.com")
else:
f = BooleanModelForm()
t = loader.get_template("template.page")
params = { 'form': f }
return HttpResponse(t.render(Context(params)))
template page:
<form action="" method="POST">
{{ form.bool_prop }}
<input type=submit>
</form>
The template page generates a checkbox for bool_prop, which is fine.
When you check the checkbox and submit the form, the form validates
fine, bool_prop is set to True and you get redirect to google.com, but
when you uncheck the checkbox, the form fails to validate with the
error "bool_prop is required".
Is this a known bug or am I doing something wrong?
TIA
-- Joe
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google App Engine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-appengine?hl=en
-~----------~----~----~----~------~----~------~--~---