Reputation: 362
I have model Verification, I want to override django model's "delete()" method for this model.
And I have one more model VerificationHistory, which few common filed as in Verification.
On delete I want to save data few fields of Verification Model in VerificationHistory model.
So that I can save few model fields in different model on delete of the object is history table also.
Is there any way to achieve this.
Upvotes: 1
Views: 360
Reputation: 21317
In Verification
model write delete
method. Save your data to VerificationHistory
and call super
of delete
. Your Verification
object will be delete and VerificationHistory
Object will be created.
You will get all model methods in docs
Upvotes: 0
Reputation: 165340
If you're trying to save object revisions, you can use django-reversion which does exactly that.
Check the documentation on how to integrate with it.
Upvotes: 1