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)

8966-charmless-admin-validation-prepopulated-type.diff (549 bytes ) - added by charmless 16 years ago.
patch.
8957-expected-result-patch.diff (818 bytes ) - added by Tom Mortimer-Jones 16 years ago.
Patch

Download all attachments as: .zip

Change History (7)

comment:1 by Adrian Holovaty, 16 years ago

Resolution: fixed
Status: newclosed

(In [9002]) Fixed #8957 -- Fixed incorrect error message when Admin prepopulated_fields refers to a field that does not exist. Thanks, charmless

comment:2 by Tom Mortimer-Jones, 16 years ago

Resolution: fixed
Status: closedreopened

Reopening this ticket as the test still fails in the same way as initially described.

in reply to:  2 ; comment:3 by Tom Mortimer-Jones, 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'.

in reply to:  3 comment:4 by Tom Mortimer-Jones, 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.

by Tom Mortimer-Jones, 16 years ago

Patch

comment:5 by Tom Mortimer-Jones, 16 years ago

Resolution: fixed
Status: reopenedclosed

My additions to this ticket are a duplicate of #9073. Sorry for this unnecessary posting. Closing again.

Note: See TracTickets for help on using tickets.
Back to Top