Opened 16 years ago
Closed 16 years ago
#8957 closed (fixed)
Typo in Admin validation exception message
Reported by: | charmless | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | dev |
Severity: | Keywords: | ||
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
If a prepopulated_fields value refers to a nonexistant field, the error message is in correct.
So for:
prepopulated_fields = {'slug': ['field_which_doesnt_exist']}
The error raised is:
'SomeAdmin.prepopulated_fields['field_which_doesnt_exist'][0]' refers to field 'field_which_doesnt_exist' that is missing from model 'Release'.
The expected error should finger 'slug' as the key with the offending source field:
'SomeAdmin.prepopulated_fields['slug'][0]' refers to field 'field_which_doesnt_exist' that is missing from model 'Release'.
This is a simple typo. Fix attached.
Attachments (2)
Change History (7)
by , 16 years ago
Attachment: | 8966-charmless-admin-validation-prepopulated-type.diff added |
---|
comment:1 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
follow-up: 3 comment:2 by , 16 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Reopening this ticket as the test still fails in the same way as initially described.
follow-up: 4 comment:3 by , 16 years ago
Replying to morty:
Reopening this ticket as the test still fails in the same way as initially described.
Sorry, it isn't exactly as described. The output of the failing test is:
Failed example: validate(ValidationTestModelAdmin, ValidationTestModel) Expected: Traceback (most recent call last): ... ImproperlyConfigured: 'ValidationTestModelAdmin.prepopulated_fields['non_existent_field'][0]' refers to field 'non_existent_field' that is missing from model 'ValidationTestModel'. Got: Traceback (most recent call last): ... ImproperlyConfigured: 'ValidationTestModelAdmin.prepopulated_fields['slug'][0]' refers to field 'non_existent_field' that is missing from model 'ValidationTestModel'.
comment:4 by , 16 years ago
I think that the test is at fault. The test is to try and populate the slug field with a non-existent field. The expected exception looks like it should be raised if you tried to populate a non-existent field with a non-existent field. Therefore I think the expected value should be changed.
comment:5 by , 16 years ago
Resolution: | → fixed |
---|---|
Status: | reopened → closed |
My additions to this ticket are a duplicate of #9073. Sorry for this unnecessary posting. Closing again.
patch.