saveasnew on error will change the title but not URL
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:
- 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.
- 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/.
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.