Ticket #8899: 8899.exclude-tuple.diff
File 8899.exclude-tuple.diff, 1.8 KB (added by , 16 years ago) |
---|
-
django/django/contrib/admin/options.py
270 270 defaults = { 271 271 "form": self.form, 272 272 "fields": fields, 273 "exclude": exclude + kwargs.get("exclude", []),273 "exclude": list(exclude) + list(kwargs.get("exclude", [])), 274 274 "formfield_callback": self.formfield_for_dbfield, 275 275 } 276 276 defaults.update(kwargs) … … 786 786 "formset": self.formset, 787 787 "fk_name": self.fk_name, 788 788 "fields": fields, 789 "exclude": exclude + kwargs.get("exclude", []),789 "exclude": list(exclude) + list(kwargs.get("exclude", [])), 790 790 "formfield_callback": self.formfield_for_dbfield, 791 791 "extra": self.extra, 792 792 "max_num": self.max_num, -
django/tests/regressiontests/modeladmin/models.py
116 116 ['name'] 117 117 118 118 119 # Using `exclude` .119 # Using `exclude` as list. 120 120 121 121 >>> class BandAdmin(ModelAdmin): 122 122 ... exclude = ['bio'] 123 123 >>> ma = BandAdmin(Band, site) 124 124 >>> ma.get_form(request).base_fields.keys() 125 125 ['name', 'sign_date'] 126 126 127 # Using `exclude` as tuple. 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):