add more messages for better helper feedback
This commit is contained in:
parent
14e18e9f2e
commit
6209a2671e
|
@ -58,6 +58,11 @@ def login(request, token):
|
|||
if not tk.helper.number_validated:
|
||||
tk.helper.number_validated = True
|
||||
tk.helper.save()
|
||||
messages.add_message(
|
||||
request,
|
||||
messages.SUCCESS,
|
||||
"Nummer bestätigt, Du kannst dich jetzt für Schichten anmelden",
|
||||
)
|
||||
request.session["token"] = token
|
||||
# if the user was viewing a single shift before registering, they probably want to register for that
|
||||
# shift so we redirect them there.
|
||||
|
@ -126,10 +131,27 @@ def shift(request, shiftid):
|
|||
if EmptyForm(request.POST).is_valid():
|
||||
if not helper:
|
||||
# todo: add flash message that signup is required?
|
||||
messages.add_message(
|
||||
request,
|
||||
messages.WARNING,
|
||||
"Bitte registriere Dich, bevor du dich zu Schichten anmeldest",
|
||||
)
|
||||
return redirect("register")
|
||||
if not helper.number_validated:
|
||||
messages.add_message(
|
||||
request,
|
||||
messages.WARNING,
|
||||
"Bitte bestätige zuerst deine Telefonnummer",
|
||||
)
|
||||
return redirect("shift", shiftid=shift.pk)
|
||||
if context["can_register"]:
|
||||
s = ShiftRegistration(helper=helper, shift=shift)
|
||||
s.save()
|
||||
messages.add_message(
|
||||
request,
|
||||
messages.SUCCESS,
|
||||
"Erfolgreich angemeldet, bitte komme eine halbe Stunde vor deiner Schicht an den Infopoint",
|
||||
)
|
||||
# redirect so page can be reloaded without resending post data
|
||||
return redirect("shift", shiftid=shift.pk)
|
||||
return render(request, "shift.html", context)
|
||||
|
@ -147,4 +169,15 @@ def cancel(request, shiftid):
|
|||
reg = get_object_or_404(ShiftRegistration, helper=helper, shift=shift)
|
||||
if reg.can_cancel():
|
||||
reg.delete()
|
||||
messages.add_message(
|
||||
request,
|
||||
messages.SUCCESS,
|
||||
"Erfolgreich abgemeldet",
|
||||
)
|
||||
else:
|
||||
messages.add_message(
|
||||
request,
|
||||
messages.WARNING,
|
||||
"Abmeldung nicht (mehr) möglich, bitte wende dich an den Infopoint",
|
||||
)
|
||||
return redirect("shift", shiftid=shiftid)
|
||||
|
|
Loading…
Reference in New Issue