Changes between Initial Version and Version 1 of Ticket #24008


Ignore:
Timestamp:
Dec 17, 2014, 8:54:14 AM (10 years ago)
Author:
Tim Graham
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #24008

    • Property Component UncategorizedCore (Other)
    • Property Triage Stage UnreviewedAccepted
    • Property Type UncategorizedBug
    • Property Version 1.61.7
  • Ticket #24008 – Description

    initial v1  
    44
    55For example:
    6 
     6{{{
    77>>> from django.core.exceptions import ValidationError
    88>>> ValidationError([ValidationError({'age', 'age cannot be negative'}), ValidationError('Some other error')])
    9 
     9}}}
    1010The problem is caused because when a ValidationError instance is initialised with a dictionary, its error_list attribute is not set (instead error_dict is set) but a ValidationError that is initialised with a list tries to compile a flattened list of all errors using this attribute from each list element.  Either ValidationError should be modified to accept a mixture of field and non-field errors (appears to me to be the best solution) or the documentation and error message should be changed to make usage clear.
    1111
Back to Top