forked from uncloud/uncloud
do not import pay->auth
Try to keep common things in the "uncloud" module
This commit is contained in:
parent
ad0c2f1e9d
commit
0fd5ac18cd
3 changed files with 8 additions and 16 deletions
|
@ -1,4 +1,11 @@
|
||||||
from django.utils.translation import gettext_lazy as _
|
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
|
# http://xml.coverpages.org/country3166.html
|
||||||
COUNTRIES = (
|
COUNTRIES = (
|
||||||
|
|
|
@ -2,8 +2,7 @@ from django.contrib.auth.models import AbstractUser
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.core.validators import MinValueValidator
|
from django.core.validators import MinValueValidator
|
||||||
|
|
||||||
from uncloud_pay import AMOUNT_DECIMALS, AMOUNT_MAX_DIGITS
|
from uncloud import AMOUNT_DECIMALS, AMOUNT_MAX_DIGITS
|
||||||
from uncloud_pay.models import get_balance_for_user
|
|
||||||
|
|
||||||
class User(AbstractUser):
|
class User(AbstractUser):
|
||||||
"""
|
"""
|
||||||
|
@ -16,10 +15,3 @@ class User(AbstractUser):
|
||||||
max_digits=AMOUNT_MAX_DIGITS,
|
max_digits=AMOUNT_MAX_DIGITS,
|
||||||
decimal_places=AMOUNT_DECIMALS,
|
decimal_places=AMOUNT_DECIMALS,
|
||||||
validators=[MinValueValidator(0)])
|
validators=[MinValueValidator(0)])
|
||||||
|
|
||||||
# @property
|
|
||||||
# def primary_billing_address(self):
|
|
||||||
|
|
||||||
@property
|
|
||||||
def balance(self):
|
|
||||||
return get_balance_for_user(self)
|
|
||||||
|
|
|
@ -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
|
|
||||||
|
|
Loading…
Reference in a new issue