Opened 7 years ago

Closed 7 years ago

Last modified 5 years ago

#10448 closed (fixed)

saveasnew on error will change the title but not URL

Reported by: whiskybar Owned by: nobody
Component: contrib.admin Version: master
Severity: Keywords: admin saveasnew
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Enable the Save as new button in the admin change form by

class MyModelAdmin(admin.ModelsAdmin)
    save_as = True

Then, if an error occurs, i.e. the form does not validate due to unique constraints, or any other custom clean_ methods, the form will appear again with errors and:

  1. The screen clearly indicates one is trying to add a new object. There is Add in the breadcrumbs, Add (object) in the header, and add is set in the template context.
  1. The URL however points to the old object's change form, i.e. .../object/NNN/ - the object's id.

Now, correcting the above errors and pressing Save will actually modify the old object and will not create a new one. I think this situation is confusing and one should either see the old object's change form or the URL should change to ..../add/.

Attachments (2)

patch10448against10203.diff (1.0 KB) - added by bastih 7 years ago.
patch10448against10203withtest.diff (3.4 KB) - added by bastih 7 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 7 years ago by jacob

  • milestone set to 1.1
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Changed 7 years ago by bastih

comment:2 Changed 7 years ago by bastih

  • Has patch set

comment:3 Changed 7 years ago by bastih

This change does not change the url (at first) but deals with the issue that one might possibly save on top of the old model while wanting to create something that is based on it.

The url changes after one tries to correct errors to changed fields.

Changed 7 years ago by bastih

comment:4 Changed 7 years ago by jacob

  • Triage Stage changed from Accepted to Ready for checkin

comment:5 Changed 7 years ago by jacob

  • Resolution set to fixed
  • Status changed from new to closed

Fixed in [10713]

comment:6 Changed 5 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

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