Ticket #9171: 9171-inlineformset_factory-r9082.2.diff
File 9171-inlineformset_factory-r9082.2.diff, 2.2 KB (added by , 16 years ago) |
---|
-
django/forms/models.py
528 528 if fk.unique: 529 529 max_num = 1 530 530 if exclude is not None: 531 exclude = list(exclude) 531 532 exclude.append(fk.name) 532 533 else: 533 534 exclude = [fk.name] -
django/contrib/admin/options.py
266 266 if self.exclude is None: 267 267 exclude = [] 268 268 else: 269 exclude = self.exclude269 exclude = list(self.exclude) 270 270 defaults = { 271 271 "form": self.form, 272 272 "fields": fields, … … 780 780 if self.exclude is None: 781 781 exclude = [] 782 782 else: 783 exclude = self.exclude783 exclude = list(self.exclude) 784 784 defaults = { 785 785 "form": self.form, 786 786 "formset": self.formset, -
tests/regressiontests/modeladmin/models.py
123 123 >>> ma = BandAdmin(Band, site) 124 124 >>> ma.get_form(request).base_fields.keys() 125 125 ['name', 'sign_date'] 126 127 # You can also pass a tuple to `exclude`. 126 128 129 >>> class BandAdmin(ModelAdmin): 130 ... exclude = ('bio',) 131 >>> ma = BandAdmin(Band, site) 132 >>> ma.get_form(request).base_fields.keys() 133 ['name', 'sign_date'] 134 127 135 # Using `fields` and `exclude`. 128 136 129 137 >>> class BandAdmin(ModelAdmin): -
tests/regressiontests/inline_formsets/models.py
51 51 Exception: <class 'regressiontests.inline_formsets.models.Child'> has no field named 'test' 52 52 53 53 54 # Regression test for #9171. 55 >>> ifs = inlineformset_factory(Parent, Child, exclude=('school',), fk_name='mother') 54 56 """ 55 57 }