Commit da0c6908 authored by Jacob Kaplan-Moss's avatar Jacob Kaplan-Moss
Browse files

Fixed #9473: FormWizard now works with NullBooleanFields. As a bonus, we now...

Fixed #9473: FormWizard now works with NullBooleanFields. As a bonus, we now have the beginnings of a test suite for FormWizard. Thanks, Keith Bussell.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@10316 bcc190cf-cafb-0310-a4f2-bffc1f526a37
parent a274ad92
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -422,7 +422,7 @@ class NullBooleanSelect(Select):

    def value_from_datadict(self, data, files, name):
        value = data.get(name, None)
        return {u'2': True, u'3': False, True: True, False: False}.get(value, None)
        return {u'2': True, u'3': False, 'True': True, 'False': False}.get(value, None)

    def _has_changed(self, initial, data):
        # Sometimes data or initial could be None or u'' which should be the
+0 −0

Empty file added.

+18 −0
Original line number Diff line number Diff line
from django import forms
from django.contrib.formtools.wizard import FormWizard
from django.http import HttpResponse

class Page1(forms.Form):
    name = forms.CharField(max_length=100)
    thirsty = forms.NullBooleanField()

class Page2(forms.Form):
    address1 = forms.CharField(max_length=100)
    address2 = forms.CharField(max_length=100)
    
class Page3(forms.Form):
    random_crap = forms.CharField(max_length=100)
    
class ContactWizard(FormWizard):
    def done(self, request, form_list):
        return HttpResponse("")
+0 −0

Empty file added.

+13 −0
Original line number Diff line number Diff line
<html>
  <body>
    <p>Step {{ step }} of {{ step_count }}</p>
    <form action="." method="post">
    <table>
    {{ form }}
    </table>
    <input type="hidden" name="{{ step_field }}" value="{{ step0 }}" />
    {{ previous_fields|safe }}
    <input type="submit">
    </form>
  </body>
</html>
 No newline at end of file
Loading