Ticket #9218: key-error-on-empty-pk-field-in-forms-fix-test.patch
File key-error-on-empty-pk-field-in-forms-fix-test.patch, 861 bytes (added by , 16 years ago) |
---|
-
regressiontests/forms/models.py
24 24 class FileForm(django_forms.Form): 25 25 file1 = django_forms.FileField() 26 26 27 class PKNotIDModel(models.Model): 28 testing = models.CharField(max_length=20, primary_key=True) 29 27 30 __test__ = {'API_TESTS': """ 28 31 >>> from django.forms.models import ModelForm 29 32 >>> from django.core.files.uploadedfile import SimpleUploadedFile … … 73 76 datetime.date(1969, 4, 4) 74 77 >>> instance_form.initial['value'] 75 78 12 79 80 # Test for primary_key not named 'id' 81 >>> class TestForm(ModelForm): 82 ... class Meta: 83 ... model = PKNotIDModel 84 ... fields = ('testing',) 85 >>> form = TestForm({u'testing': u''}) 86 >>> form.is_valid() 87 False 76 88 """}