#23387: Error when saving inline formsets as new after a validation error.
-------------------------------------+-------------------------------------
Reporter: johnrtipton | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: admin formset | Triage Stage:
validation base10 | Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Description changed by johnrtipton:
Old description:
> This bug seems to have been around for a long time, as I've tried this
> from version 1.4 up.
>
> While in the admin, if you have a form with inline formsets and you try
> to do a save as new, it works properly, unless there is a validation
> error. If you get a validation error, Django sends you through the
> add_view which no longer as the "Save as new" option. If you click save
> here, you will get the error below:
>
> ValueError at /admin/drawings/sow/add/
> invalid literal for int() with base 10: ''
> Request Method: POST
> Request URL: http://127.0.0.1:8000/admin/drawings/sow/add/
> Django Version: 1.6.6.dev20140829183230
> Exception Type: ValueError
> Exception Value:
> invalid literal for int() with base 10: ''
> Exception Location:
> /Users/tip/Dropbox/websites/isotekrms/django/db/models/fields/__init__.py
> in get_prep_value, line 613
> Python Executable:
> /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
> Python Version: 2.7.6
>
> I, have written a small patch that will check to see if the formset had
> validation errors and it was submitted as a save as new, it will set the
> context variable change=True which causes the "Save as new" button to
> show on the form again. Fixing the validation errors on the screen and
> pressing "Save as new" again will save the form properly.
New description:
This bug seems to have been around for a long time, as I've tried this
from version 1.4 up.
While in the admin, if you have a form with inline formsets and you try to
do a save as new, it works properly, unless there is a validation error.
If you get a validation error, Django sends you through the add_view which
no longer has the "Save as new" option. If you click save here, you will
get the error below:
ValueError at /admin/drawings/sow/add/
invalid literal for int() with base 10: ''
Request Method: POST
Request URL: http://127.0.0.1:8000/admin/drawings/sow/add/
Django Version: 1.6.6.dev20140829183230
Exception Type: ValueError
Exception Value:
invalid literal for int() with base 10: ''
Exception Location:
/Users/tip/Dropbox/websites/isotekrms/django/db/models/fields/__init__.py
in get_prep_value, line 613
Python Executable:
/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
Python Version: 2.7.6
I, have written a small patch that will check to see if the formset had
validation errors and it was submitted as a save as new, it will set the
context variable change=True which causes the "Save as new" button to show
on the form again. Fixing the validation errors on the screen and
pressing "Save as new" again will save the form properly.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/23387#comment:2>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/069.c5fb5917a3b57f049041000c389a6602%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.