From c371da90c3a9a3ca051e00d51a6816af49f22920 Mon Sep 17 00:00:00 2001 From: Ivlev Denis Date: Tue, 27 Feb 2018 12:45:42 +0300 Subject: [PATCH] update link for buy school --- apps/payment/views.py | 8 ++++++-- project/templates/lilcity/index.html | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/apps/payment/views.py b/apps/payment/views.py index f2b4d190..dca03110 100644 --- a/apps/payment/views.py +++ b/apps/payment/views.py @@ -50,11 +50,15 @@ class SchoolBuyView(TemplateView): def get(self, request, *args, **kwargs): host = request.scheme + '://' + request.get_host() - weekdays = request.GET.get('weekdays', []) + weekdays = set(request.GET.getlist('weekdays', [])) if not weekdays: messages.error(request, 'Выберите несколько дней недели.') return redirect('index') - weekdays = [int(weekday) for weekday in weekdays] + try: + weekdays = [int(weekday) for weekday in weekdays] + except ValueError: + messages.error(request, 'Ошибка выбора дней недели.') + return redirect('index') school_payment = SchoolPayment.objects.create( user=request.user, weekdays=weekdays, diff --git a/project/templates/lilcity/index.html b/project/templates/lilcity/index.html index b9e7643e..2f8c70e9 100644 --- a/project/templates/lilcity/index.html +++ b/project/templates/lilcity/index.html @@ -469,7 +469,10 @@ -
ПЕРЕЙТИ К ОПЛАТЕ
+
+ {% comment %}В ссылке, в параметре запроса weekdays, нужно указать выбранные дни недели{% endcomment %} + ПЕРЕЙТИ К ОПЛАТЕ +