def test_confirm_action(rf, staff_user): request = rf.get('/customer/details') request.user = staff_user _confirm_action(site._registry[DemoModel1], request, lambda r: True, "Confirm action", "Successfully executed", description="", pk=None, extra_context={'a': 1})
def empty_log(self, request): def _action(request): cursor = connection.cursor() cursor.execute('TRUNCATE TABLE "{0}"'.format(Error._meta.db_table)) return _confirm_action(self, request, _action, "Confirm deletion whole error log", "Successfully executed")
def confirm(self, request): def _action(request): pass return _confirm_action( self, request, _action, "Confirm action", "Successfully executed", )
def unlock(self, request, pk): obj = self.get_object(request, pk) def _action(request): obj.loader.unlock() return _confirm_action(self, request, _action, f"""Continuing will unlock selected task. ({obj.task}). {obj.loader.task.name} - {obj.loader.config.lock_key} """, "Successfully executed", )