Opened 6 years ago
Closed 6 years ago
#29818 closed Bug (needsinfo)
ValueError when parsing querydata to autofill a Django admin form
Reported by: | Nastuzzi Samy | Owned by: | nobody |
---|---|---|---|
Component: | contrib.admin | Version: | 2.1 |
Severity: | Normal | Keywords: | django admin |
Cc: | Herbert Fortes | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
When giving a pure string instead of an expected integer
(ex: http://localhost:8002/admin/core/zone/add/?_to_field=id&_popup=1&event=plsbreak with event = 'plsbreak') , Django admin breaks
"Error during template rendering
In template /usr/local/lib/python3.6/site-packages/django/contrib/admin/templates/admin/includes/fieldset.html, error at line 19"
Change History (5)
comment:1 by , 6 years ago
Easy pickings: | unset |
---|
follow-up: 4 comment:2 by , 6 years ago
I also tried to reproduce.
[03/Oct/2018 13:36:58] "POST /admin/core/course/add/?_to_field=id&_popup=1&event=plsbreak HTTP/1.1" 200 10098
I do not sure if it is a valid try but no crash here.
comment:3 by , 6 years ago
Cc: | added |
---|
comment:4 by , 6 years ago
Replying to Herbert Fortes:
I also tried to reproduce.
[03/Oct/2018 13:36:58] "POST /admin/core/course/add/?_to_field=id&_popup=1&event=plsbreak HTTP/1.1" 200 10098
I am sorry for the "POST". Copy and Paste the wrong line.
But I can not reproduce the ticket.
comment:5 by , 6 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
When giving a pure string instead of an expected integer ...
I couldn't reproduce this.
- When using the expected integer the field is pre-populated with the correct value.
- When using a string (which is clearly invalid) the form renders normally, without a pre-populated value.
I don't see a crash.
Thus there must be something else going on in your situation. If you are able to pin it down to a concrete reproduce case we can investigate.
Can you give more specific steps to reproduce? At first glance, it seems like the problem is putting a string in a foreign key field but I tried with the URL
/admin/polls/choice/add/?question=xxx
(from the tutorial) and don't see a crash.