|
|
|
|
@ -1,20 +1,18 @@ |
|
|
|
|
from django.conf import urls, settings |
|
|
|
|
from django.conf import settings |
|
|
|
|
from django.contrib import messages |
|
|
|
|
from django.contrib.auth.mixins import LoginRequiredMixin |
|
|
|
|
from django.db.models import Sum |
|
|
|
|
from django.http import HttpResponse, JsonResponse, HttpResponseForbidden |
|
|
|
|
from django.http import HttpResponse, JsonResponse |
|
|
|
|
from django.shortcuts import render, get_object_or_404 |
|
|
|
|
from django.utils import timezone |
|
|
|
|
from django.utils.decorators import method_decorator |
|
|
|
|
from django.views.decorators.csrf import csrf_exempt |
|
|
|
|
from django.views.generic import DetailView, CreateView |
|
|
|
|
from django.views.generic.base import View |
|
|
|
|
from pprint import pprint, pformat |
|
|
|
|
import logging |
|
|
|
|
|
|
|
|
|
from users.models import User |
|
|
|
|
from .forms import WithDrawForm, TmpCheckOrderForm, TmpPaymentAvisoForm |
|
|
|
|
from .models import InvoiceHistory, WithDraw, Transaction |
|
|
|
|
from users.mixins import CheckForUserMixin |
|
|
|
|
from users.models import User |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ScoreDetailView(DetailView): |
|
|
|
|
@ -30,12 +28,11 @@ class ScoreDetailView(DetailView): |
|
|
|
|
return context |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ScoreView(View): |
|
|
|
|
class ScoreView(LoginRequiredMixin, View): |
|
|
|
|
template_name = 'score-detail.html' |
|
|
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs): |
|
|
|
|
# transaction = Transaction.objects.get_or_create(customer=request.user, complete=False) |
|
|
|
|
transaction = Transaction.objects.create(customer=request.user,type='add') |
|
|
|
|
transaction = Transaction.objects.create(customer=request.user, type='add') |
|
|
|
|
user_score = get_object_or_404(User.objects, pk=kwargs.get('pk')) |
|
|
|
|
current_sum_info = InvoiceHistory.objects.filter(user=user_score).aggregate(Sum('sum')) |
|
|
|
|
user_score_balance = current_sum_info['sum__sum'] or 0 |
|
|
|
|
@ -96,7 +93,6 @@ class WithDrawCreate(CreateView): |
|
|
|
|
return super().form_invalid(form) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Yandex Money ------------------------------------------------ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|