Opened 8 years ago

Closed 8 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:

Description

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 sebastian.hillig 8 years ago.
patch10448against10203withtest.diff (3.4 KB) - added by sebastian.hillig 8 years ago.

Download all attachments as: .zip

Change History (8)

comment:1 Changed 8 years ago by Jacob

milestone: 1.1
Triage Stage: UnreviewedAccepted

Changed 8 years ago by sebastian.hillig

Attachment: patch10448against10203.diff added

comment:2 Changed 8 years ago by sebastian.hillig

Has patch: set

comment:3 Changed 8 years ago by sebastian.hillig

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 8 years ago by sebastian.hillig

comment:4 Changed 8 years ago by Jacob

Triage Stage: AcceptedReady for checkin

comment:5 Changed 8 years ago by Jacob

Resolution: fixed
Status: newclosed

Fixed in [10713]

comment:6 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

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