saveasnew on error will change the title but not URL
|Reported by:||whiskybar||Owned by:||nobody|
|Cc:||Triage Stage:||Ready for checkin|
|Has patch:||yes||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
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/.