|
|
|
|
@ -2,6 +2,7 @@ import logging |
|
|
|
|
import json |
|
|
|
|
|
|
|
|
|
from datetime import timedelta |
|
|
|
|
from urllib.parse import urlsplit |
|
|
|
|
|
|
|
|
|
from django.contrib import messages |
|
|
|
|
from django.contrib.auth.decorators import login_required |
|
|
|
|
@ -43,7 +44,8 @@ class CourseBuyView(TemplateView): |
|
|
|
|
template_name = 'payment/paymentwall_widget.html' |
|
|
|
|
|
|
|
|
|
def get(self, request, pk=None, *args, **kwargs): |
|
|
|
|
host = request.scheme + '://' + request.get_host() |
|
|
|
|
host = urlsplit(self.request.META.get('HTTP_REFERER')) |
|
|
|
|
host = host[0] + '://' + host[1] |
|
|
|
|
course = Course.objects.get(id=pk) |
|
|
|
|
if request.user == course.author: |
|
|
|
|
messages.error(request, 'Вы не можете приобрести свой курс.') |
|
|
|
|
@ -79,9 +81,8 @@ class SchoolBuyView(TemplateView): |
|
|
|
|
template_name = 'payment/paymentwall_widget.html' |
|
|
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs): |
|
|
|
|
host = self.request.META.get('HTTP_REFERER') |
|
|
|
|
if host.endswith('/'): |
|
|
|
|
host = host[:-1] |
|
|
|
|
host = urlsplit(self.request.META.get('HTTP_REFERER')) |
|
|
|
|
host = host[0] + '://' + host[1] |
|
|
|
|
weekdays = set(request.GET.getlist('weekdays', [])) |
|
|
|
|
if not weekdays: |
|
|
|
|
messages.error(request, 'Выберите несколько дней недели.') |
|
|
|
|
|