Opened 7 years ago

Closed 7 years ago

#9663 closed (duplicate)

save_as with inlines is broken after changeset 9297

Reported by: peritus Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


The save_as functionality fails after revision [9297] / [9298], when using inlines.

I have attached a patch with a updated admin_views test to include CHILD_set-N-PARENT for the ordinary change_form edit test, and I also added a test for save_as in the same test.

The test succeeds for revisions < [9297], since it simply does not care about the FK field.

It might be suitable for better tests for the formsets themselves, but I am not quite sure how to test them properly.

A comment in #8882 mentions this bug too (#8882 is the ticket that r9297 fixed)

If you like to test this manually, outside of the testsuite, I have also attached a test project with a sqlite database which can be used to test the bug right away:

  1. Admin login: test / test
  2. Open the existing "Parent"-object (change form) and hit "Save as new" without changing any fields.
  3. The first error is "Please correct the errors below."
  4. If you hit "Save" again, a KeyError will be raised and unhandled.

The unittest in the patch does *NOT* test for the KeyError-exception, since I am not sure if that is the proper thing to do here, or if that is related to this issue at all.

This bug affects both the 1.0.X branch and trunk.

Attachments (2)

save_as_inline_tests.diff (3.0 KB) - added by peritus 7 years ago.
Updated admin_views unit tests
save_as_inline.tar.gz (5.4 KB) - added by peritus 7 years ago.
Example project

Download all attachments as: .zip

Change History (3)

Changed 7 years ago by peritus

Updated admin_views unit tests

Changed 7 years ago by peritus

Example project

comment:1 Changed 7 years ago by kmtracey

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to duplicate
  • Status changed from new to closed

#9651 already reported this. Thanks for the testcases, I've noted them in the previous ticket.

Note: See TracTickets for help on using tickets.
Back to Top