-
Notifications
You must be signed in to change notification settings - Fork 53
Using the provided ModelAdmin it creates a new version even when there are errors #107
Comments
I was able to confirm with a field that does the validation in the Python like EmailField, that cloning happens even though errors happen. @rasca, I think you are right that the cloning should happen in save_model. The below seemed to work, but I don't have time to fully test it out.
|
I don't think that solution will work. In the upcoming 1.9 cloning the object in |
I think I found a solution for 1.8 and earlier:
What do you think? We should also update each |
@rasca Sorry for the delay, when I ran that code it saves the previous object with the updated (cloned) information, so a City named Northfield gets cloned and renamed to Demascus then they both are Demascus. |
Yes.. I ended up using this code:
Though it takes two additional queries and messes with version_start_date manually. |
You clone the object in
get_object
before the forms validation take place.I think the correct place to do this would be in
save_model()
taking into consideration that it also affectssave_related()
.The text was updated successfully, but these errors were encountered: