do not import pay->auth

Try to keep common things in the "uncloud" module
This commit is contained in:
Nico Schottelius 2020-12-06 11:53:37 +01:00
parent ad0c2f1e9d
commit 0fd5ac18cd
3 changed files with 8 additions and 16 deletions

View File

@ -1,4 +1,11 @@
from django.utils.translation import gettext_lazy as _
import decimal
# Define DecimalField properties, used to represent amounts of money.
AMOUNT_MAX_DIGITS=10
AMOUNT_DECIMALS=2
decimal.getcontext().prec = AMOUNT_DECIMALS
# http://xml.coverpages.org/country3166.html
COUNTRIES = (

View File

@ -2,8 +2,7 @@ from django.contrib.auth.models import AbstractUser
from django.db import models
from django.core.validators import MinValueValidator
from uncloud_pay import AMOUNT_DECIMALS, AMOUNT_MAX_DIGITS
from uncloud_pay.models import get_balance_for_user
from uncloud import AMOUNT_DECIMALS, AMOUNT_MAX_DIGITS
class User(AbstractUser):
"""
@ -16,10 +15,3 @@ class User(AbstractUser):
max_digits=AMOUNT_MAX_DIGITS,
decimal_places=AMOUNT_DECIMALS,
validators=[MinValueValidator(0)])
# @property
# def primary_billing_address(self):
@property
def balance(self):
return get_balance_for_user(self)

View File

@ -1,8 +1 @@
import decimal
# Define DecimalField properties, used to represent amounts of money.
AMOUNT_MAX_DIGITS=10
AMOUNT_DECIMALS=2
decimal.getcontext().prec = AMOUNT_DECIMALS