Opened 15 years ago

Closed 15 years ago

Last modified 12 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: dev
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: no UI/UX: no

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

Download all attachments as: .zip

Change History (8)

comment:1 by Jacob, 15 years ago

milestone: 1.1
Triage Stage: UnreviewedAccepted

by sebastian.hillig, 15 years ago

Attachment: patch10448against10203.diff added

comment:2 by sebastian.hillig, 15 years ago

Has patch: set

comment:3 by sebastian.hillig, 15 years ago

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.

by sebastian.hillig, 15 years ago

comment:4 by Jacob, 15 years ago

Triage Stage: AcceptedReady for checkin

comment:5 by Jacob, 15 years ago

Resolution: fixed
Status: newclosed

Fixed in [10713]

comment:6 by Jacob, 12 years ago

milestone: 1.1

Milestone 1.1 deleted

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