huddlej/django-csv-admin — Issue #2: Save validated records within a database transaction
Author: huddlej
Created: 2011-11-05 20:24:33+00:00
State: open

Instead of saving records in a try/except block and deleting all saved records when a save fails, use a database transaction for all saves and only commit the transaction when all saves complete successfully.

Users with MySQL MyISAM tables will need to convert to InnoDB tables to get transactions. The default table engine can be set in Django's settings:

DATABASE_OPTIONS = {
"init_command": "SET storage_engine=INNODB",
}