Ticket #10928: 10928-r11178.diff
File 10928-r11178.diff, 2.0 KB (added by , 15 years ago) |
---|
-
tests/regressiontests/model_forms_regress/tests.py
6 6 from django.conf import settings 7 7 from django.test import TestCase 8 8 9 from models import Person, Triple, FilePathModel, Article, Publication, CustomFF 9 from models import Person, Triple, FilePathModel, Article, Publication, CustomFF, DirectDefaultBoolean, CallableDefaultBoolean 10 10 11 11 class ModelMultipleChoiceFieldTests(TestCase): 12 12 … … 100 100 # It's enough that the form saves without error -- the custom save routine will 101 101 # generate an AssertionError if it is called more than once during save. 102 102 form = CFFForm(data = {'f': None}) 103 form.save() 104 No newline at end of file 103 form.save() 104 105 class DirectDefaultBooleanForm(forms.ModelForm): 106 class Meta: 107 model = DirectDefaultBoolean 108 109 class CallableDefaultBooleanForm(forms.ModelForm): 110 class Meta: 111 model = CallableDefaultBoolean 112 113 class CallableVersusDirectDefaultTests(TestCase): 114 def test_equality(self): 115 "Regression for #10928: BooleanField: different behaviour when default=callable" 116 117 self.assertEquals(DirectDefaultBooleanForm().as_p(), CallableDefaultBooleanForm().as_p()) 118 119 No newline at end of file -
tests/regressiontests/model_forms_regress/models.py
37 37 38 38 class CustomFF(models.Model): 39 39 f = CustomFileField(upload_to='unused', blank=True) 40 41 class DirectDefaultBoolean(models.Model): 42 b = models.BooleanField(default=False) 43 44 class CallableDefaultBoolean(models.Model): 45 b = models.BooleanField(default=lambda: False) 46 47