From 7353348d7abd38fae661ef74db11591e5f5b420f Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sun, 20 Sep 2020 09:07:51 +0200 Subject: [PATCH 1/2] Rollback transaction when checking an add permission (experimental) --- apps/permission/models.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/permission/models.py b/apps/permission/models.py index ee7d3ec4..17214894 100644 --- a/apps/permission/models.py +++ b/apps/permission/models.py @@ -43,6 +43,7 @@ class InstancedPermission: obj = copy(obj) obj.pk = 0 with transaction.atomic(): + sid = transaction.savepoint() for o in self.model.model_class().objects.filter(pk=0).all(): o._force_delete = True Model.delete(o) @@ -65,6 +66,7 @@ class InstancedPermission: obj._no_signal = True obj._force_delete = True Model.delete(obj) + transaction.savepoint_rollback(sid) return ret From 3ba61385a3eb99bed426f9af36494f5975634ec3 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sun, 20 Sep 2020 11:12:44 +0200 Subject: [PATCH 2/2] Debit is not credit --- apps/note/static/note/js/transfer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/note/static/note/js/transfer.js b/apps/note/static/note/js/transfer.js index db9cf9ac..f6b23b29 100644 --- a/apps/note/static/note/js/transfer.js +++ b/apps/note/static/note/js/transfer.js @@ -388,7 +388,7 @@ $('#btn_transfer').click(function () { alias = sources_notes_display[0].name source_id = user_note.id dest_id = special_note - reason = 'Retrait ' + $('#credit_type option:selected').text().toLowerCase() + reason = 'Retrait ' + $('#debit_type option:selected').text().toLowerCase() if (given_reason.length > 0) { reason += ' (' + given_reason + ')' } } $.post('/api/note/transaction/transaction/',