|
|
|
@ -9,7 +9,6 @@ from django.contrib.postgres import fields as pgfields |
|
|
|
from django.utils.translation import gettext_lazy as _ |
|
|
|
from django.utils.translation import gettext_lazy as _ |
|
|
|
|
|
|
|
|
|
|
|
from api.v1 import serializers |
|
|
|
from api.v1 import serializers |
|
|
|
from apps.payment.models import AuthorBalance |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class User(AbstractUser): |
|
|
|
class User(AbstractUser): |
|
|
|
@ -64,7 +63,7 @@ class User(AbstractUser): |
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
|
@property |
|
|
|
def balance(self): |
|
|
|
def balance(self): |
|
|
|
aggregate = self.balances.filter(type=AuthorBalance.IN).aggregate( |
|
|
|
aggregate = self.balances.filter(type=0).aggregate( |
|
|
|
models.Sum('amount'), |
|
|
|
models.Sum('amount'), |
|
|
|
models.Sum('commission'), |
|
|
|
models.Sum('commission'), |
|
|
|
) |
|
|
|
) |
|
|
|
|