Ticket #10363: 10363.diff
File 10363.diff, 1.6 KB (added by , 16 years ago) |
---|
-
django/forms/models.py
322 322 fail_message = 'created' 323 323 else: 324 324 fail_message = 'changed' 325 return save_instance(self, self.instance, self._meta.fields, fail_message, commit) 325 exclude = self._meta.exclude or [] 326 return save_instance(self, self.instance, self._meta.fields, 327 fail_message, commit, exclude=exclude) 326 328 327 329 save.alters_data = True 328 330 -
tests/regressiontests/forms/models.py
29 29 class FileForm(django_forms.Form): 30 30 file1 = django_forms.FileField() 31 31 32 32 33 __test__ = {'API_TESTS': """ 33 34 >>> from django.forms.models import ModelForm 34 35 >>> from django.core.files.uploadedfile import SimpleUploadedFile … … 78 79 datetime.date(1969, 4, 4) 79 80 >>> instance_form.initial['value'] 80 81 12 82 83 >>> from django.forms import CharField 84 >>> class ExcludingForm(ModelForm): 85 ... name = CharField(max_length=256) 86 ... class Meta: 87 ... model = Defaults 88 ... exclude = ['name'] 89 >>> f = ExcludingForm({'name': u'Hello', 'value': 99, 'def_date': datetime.date(1999, 3, 2)}) 90 >>> f.is_valid() 91 True 92 >>> f.cleaned_data['name'] 93 u'Hello' 94 >>> obj = f.save() 95 >>> obj.name 96 u'class default value' 97 >>> obj.value 98 99 99 >>> obj.def_date 100 datetime.date(1999, 3, 2) 81 101 """}