KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have a Django application where I allow a user to import a CSV file with contact data (membership #, first name, last name, etc). When they import the file, the application checks the database for a matching record and either: 1) inserts a new record if no match exists, or 2) updates the existing data with the new data. My question is: what is the best way to implement an undo feature, using Django or straight Python, so that a user can undo the import operation and revert multiple records back to their original state? My initial thoughts are to create a table like this (pseudo code): Table HISTORY unique_id record_affected_id old_value new_value Then if the user clicks "Undo" I can look up the unique_id that's associated with their transaction and set every record affected by that transaction to the old_value. I'm wondering if there's a simpler way to do this that I'm missing, or if anyone has experience with something like this.
Tags (comma-separated)
Save Edits
Cancel