Opened 9 years ago
Closed 9 years ago
#25841 closed Bug (fixed)
ArrayField validation doesn't deal with its base field validation error message and params correctly.
Reported by: | Wael BEN ZID EL GUEBSI | Owned by: | Simon Charette |
---|---|---|---|
Component: | contrib.postgres | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Ready for checkin | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
In the admin site when I entered a bad data for a postgres ArrayField, I got Http 500, my field is defined as bellow:
platforms = ArrayField( models.CharField(max_length=10, choices=PLATFORMS_CHOICES), verbose_name=_("Supported platforms") )
You can see the traceback here
I also created validator for the platforms field, but it seems that the error happens before calling my validator
Change History (6)
comment:1 by , 9 years ago
Owner: | set to |
---|---|
Status: | new → assigned |
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 9 years ago
Has patch: | set |
---|---|
Needs tests: | set |
Patch needs improvement: | set |
Here's a proposed patch which is missing tests.
Could you confirm it fixes your issue?
comment:3 by , 9 years ago
Needs tests: | unset |
---|---|
Patch needs improvement: | unset |
I'm pretty confident the patch does solve the reported issue.
comment:4 by , 9 years ago
Summary: | Rendering errors in django admin site causes a HTTP 500 → ArrayField validation doesn't deal with its base field validation error message and params correctly. |
---|
comment:5 by , 9 years ago
Triage Stage: | Accepted → Ready for checkin |
---|
Note:
See TracTickets
for help on using tickets.
Confirmed with the latest Django 1.8 and master.
It looks like while
django.contrib.postgres.forms.array.SimpleArrayField
concatenates it's underlying field's error message it doesn't pass the original exception's parameters.