parent
ca2065a94d
commit
ec447e0dc4
8 changed files with 106 additions and 13 deletions
|
|
@ -3,7 +3,6 @@ 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
|
||||
|
||||
class User(AbstractUser):
|
||||
|
|
@ -18,6 +17,12 @@ class User(AbstractUser):
|
|||
decimal_places=AMOUNT_DECIMALS,
|
||||
validators=[MinValueValidator(0)])
|
||||
|
||||
# Need to use the string here to prevent a circular import
|
||||
primary_billing_address = models.ForeignKey('uncloud_pay.BillingAddress',
|
||||
on_delete=models.PROTECT,
|
||||
blank=True,
|
||||
null=True)
|
||||
|
||||
@property
|
||||
def balance(self):
|
||||
return get_balance_for_user(self)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue