diff --git a/uncloud_django_based/uncloud/uncloud_pay/models.py b/uncloud_django_based/uncloud/uncloud_pay/models.py index b06473e..3b4535c 100644 --- a/uncloud_django_based/uncloud/uncloud_pay/models.py +++ b/uncloud_django_based/uncloud/uncloud_pay/models.py @@ -455,9 +455,9 @@ class BillingAddress(models.Model): def get_addresses_for(user): return BillingAddress.objects.filter(owner=user) - @staticmethod - def get_preferred_address_for(user): - addresses = get_addresses_for(user) + @classmethod + def get_preferred_address_for(cls, user): + addresses = cls.get_addresses_for(user) if len(addresses) == 0: return None else: @@ -927,7 +927,7 @@ class Product(UncloudModel): billing_address = BillingAddress.get_preferred_address_for(self.owner) if not billing_address: - raise ValidationError("Cannot create order without a billing address") + raise ValidationError("Cannot order without a billing address") self.order = Order(owner=self.owner, billing_address=billing_address)