From 5beafb2c6bb8f2dc06c9a7422e7be504a13793a7 Mon Sep 17 00:00:00 2001 From: Sachi King Date: Sun, 21 Jan 2018 11:21:56 +1100 Subject: [PATCH] Disallow profile updating if user is checked in It gives a flash and pops the user back to dashboard. --- vendor/registrasion/registrasion/views.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/vendor/registrasion/registrasion/views.py b/vendor/registrasion/registrasion/views.py index ee3d6fba..e4dae6dc 100644 --- a/vendor/registrasion/registrasion/views.py +++ b/vendor/registrasion/registrasion/views.py @@ -36,6 +36,7 @@ from django.http import Http404, HttpResponse from django.shortcuts import redirect from django.shortcuts import render from django.template import Context, Template, loader +from django.urls import reverse import waffle from lxml import etree @@ -373,6 +374,13 @@ def edit_profile(request): ''' + if hasattr(request.user, "checkin"): + if request.user.checkin.checked_in_bool: + messages.add_message( + request, messages.ERROR, + 'Profile cannot be edited as you have been checked in') + return redirect(reverse('dashboard')) + form, handled = _handle_profile(request, "profile") if handled and not form.errors: