From 246c22ce3943311f760e98bf6db8279a2be71c22 Mon Sep 17 00:00:00 2001
From: bronsen <kontakt+gitcommit@nrrd.de>
Date: Sat, 15 Mar 2025 22:28:46 +0100
Subject: [PATCH] [codestyle] shortly explain why we wrap `.create()` in a
 transaction

---
 collector/views.py | 2 ++
 1 file changed, 2 insertions(+)

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: