From 6c60d411b4223026cf6188c053d375597d3240f5 Mon Sep 17 00:00:00 2001 From: Ivlev Denis Date: Mon, 12 Mar 2018 12:08:53 +0300 Subject: [PATCH] Fix card field --- apps/user/models.py | 3 +-- apps/user/views.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/apps/user/models.py b/apps/user/models.py index e0b7afa8..eb8bf8a3 100644 --- a/apps/user/models.py +++ b/apps/user/models.py @@ -9,7 +9,6 @@ from django.contrib.postgres import fields as pgfields from django.utils.translation import gettext_lazy as _ from api.v1 import serializers -from apps.payment.models import AuthorBalance class User(AbstractUser): @@ -64,7 +63,7 @@ class User(AbstractUser): @property def balance(self): - aggregate = self.balances.filter(type=AuthorBalance.IN).aggregate( + aggregate = self.balances.filter(type=0).aggregate( models.Sum('amount'), models.Sum('commission'), ) diff --git a/apps/user/views.py b/apps/user/views.py index 69e42bef..44d9a486 100644 --- a/apps/user/views.py +++ b/apps/user/views.py @@ -115,7 +115,7 @@ class PaymentHistoryView(FormView): type=AuthorBalance.OUT, amount=form.cleaned_data['amount'], status=AuthorBalance.PENDING, - card=form.cleaned_data['amount'], + card=form.cleaned_data['card'], ) return self.form_valid(form) else: