Ticket #7772: fields_and_fields.diff
File fields_and_fields.diff, 2.1 KB (added by , 16 years ago) |
---|
-
django/django/contrib/admin/validation.py
154 154 _check_istuplew('fields', cls.fields) 155 155 for field in cls.fields: 156 156 _check_field_existsw('fields', field) 157 if cls.fieldsets: 158 raise ImproperlyConfigured('Both fieldsets and fields are specified in %s.' % cls.__name__) 157 159 158 160 # fieldsets 159 161 if cls.fieldsets: # default value is None -
django/django/contrib/admin/options.py
143 143 radio_fields = {} 144 144 prepopulated_fields = {} 145 145 146 def __init__(self):147 # TODO: This should really go in django.core.validation, but validation148 # doesn't work on ModelAdmin classes yet.149 if self.fieldsets and self.fields:150 raise ImproperlyConfigured('Both fieldsets and fields is specified for %s.' % self.model)151 152 146 def formfield_for_dbfield(self, db_field, **kwargs): 153 147 """ 154 148 Hook for specifying the form Field instance for a given database Field -
django/tests/regressiontests/modeladmin/models.py
337 337 ... fieldsets = (("General", {"fields": ("name",)}),) 338 338 >>> validate(ValidationTestModelAdmin, ValidationTestModel) 339 339 340 >>> class ValidationTestModelAdmin(ModelAdmin): 341 ... fieldsets = (("General", {"fields": ("name",)}),) 342 ... fields = ["name",] 343 >>> validate(ValidationTestModelAdmin, ValidationTestModel) 344 Traceback (most recent call last): 345 ... 346 ImproperlyConfigured: Both fieldsets and fields are specified in ValidationTestModelAdmin. 347 340 348 # form 341 349 342 350 >>> class FakeForm(object):