#33893: Admin add model page incorrectly redirects
------------------------------------------+------------------------
Reporter: Fabian Jarrett | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 4.1
Severity: Normal | Keywords: admin
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------+------------------------
In the admin when clicking "add model +" I fill out the fields to create
my item then when I click "Save and add another" or "Save and continue
editing" it redirects back to the model list view even though the item was
added successfully. If I click back on to the item to edit it the buttons
work how they should.
Looks like "_addanother" isn't in the request.POST:
https://github.com/django/django/blob/main/django/contrib/admin/options.py#L1388
The name on the input isn't being passed with the form submit:
https://github.com/django/django/blob/main/django/contrib/admin/templates/admin/submit_line.html#L6
If I comment out overriding the submit it works as expected:
https://github.com/django/django/blob/main/django/contrib/admin/static/admin/js/change_form.js#L11:L19
Also when editing an item that has already been created "modelName" is
undefined so the submit buttons don't get overridden:
https://github.com/django/django/blob/main/django/contrib/admin/static/admin/js/change_form.js#L8
So works when editing, but not when adding a new item.
I think this change is causing the issue?
https://github.com/django/django/commit/fe7dbef5867c577995f0fc849d8dfdb8f2e6bbfa
--
Ticket URL: <https://code.djangoproject.com/ticket/33893>
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 view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070182681bcd1b-91d6bf8d-2409-46e2-aa01-95db4856f0af-000000%40eu-central-1.amazonses.com.