diff --git a/collector/views.py b/collector/views.py index 5e25b6b..a273c68 100644 --- a/collector/views.py +++ b/collector/views.py @@ -48,6 +48,8 @@ class DetailView(generic.DetailView): @require_http_methods(["POST"]) def enter(request: HttpRequest) -> HttpResponse: try: + # if .create() failed, the transaction is rolled back and we are in a + # clean (database) state to handle exceptions with transaction.atomic(): teil = Teil.objects.create(name=request.POST["new_name"]) except Exception: