Skip to content
Snippets Groups Projects
Verified Commit 3f7e20c4 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Pass on comment to next checkpoint view

parent dfbe15d7
No related branches found
No related tags found
1 merge request!30Resolve "Checkpoint system"
Pipeline #76041 failed
......@@ -9,6 +9,7 @@ from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse, reverse_lazy
from django.utils import timezone
from django.utils.decorators import method_decorator
from django.utils.http import urlencode
from django.utils.text import slugify
from django.utils.translation import ugettext as _
from django.views.decorators.cache import never_cache
......@@ -973,6 +974,12 @@ class EventCheckpointView(PermissionRequiredMixin, FormView):
permission_required = "paweljong.can_checkpoint"
form_class = EventCheckpointForm
def get_initial():
initial = super().get_initial() or {}
if "comment" in request.GET:
initial["comment"] = request.GET.get("comment")
return initial
def form_valid(self, form):
checkpoint = Checkpoint()
......@@ -991,10 +998,11 @@ class EventCheckpointView(PermissionRequiredMixin, FormView):
checkpoint.save()
messages.success(self.request, _("Person successfully checked."))
self._comment = checkpoint.comment
return super().form_valid(self)
def get_success_url(self):
return reverse("event_by_name_checkpoint", kwargs={"slug": self.kwargs["slug"]})
return reverse("event_by_name_checkpoint", kwargs={"slug": self.kwargs["slug"]}) + "?" + urlencode({"comment": self._comment})
class ViewTerms(PermissionRequiredMixin, DetailView):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment