forked from uncloud/uncloud
Start wiring BillingAddresses to bills & orders
This commit is contained in:
parent
3fa1d5753e
commit
0522927c50
3 changed files with 66 additions and 19 deletions
|
|
@ -2,7 +2,7 @@ from rest_framework import serializers
|
|||
from .models import *
|
||||
from uncloud_vm.serializers import ManagedVMProductSerializer
|
||||
from uncloud_vm.models import VMProduct
|
||||
from uncloud_pay.models import RecurringPeriod
|
||||
from uncloud_pay.models import RecurringPeriod, BillingAddress
|
||||
|
||||
class MatrixServiceProductSerializer(serializers.ModelSerializer):
|
||||
vm = ManagedVMProductSerializer()
|
||||
|
|
@ -11,9 +11,15 @@ class MatrixServiceProductSerializer(serializers.ModelSerializer):
|
|||
recurring_period = serializers.ChoiceField(
|
||||
choices=MatrixServiceProduct.allowed_recurring_periods())
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(MatrixServiceProductSerializer, self).__init__(*args, **kwargs)
|
||||
self.fields['billing_address'] = serializers.ChoiceField(
|
||||
choices=BillingAddress.get_addresses_for(self.context['request'].user))
|
||||
|
||||
class Meta:
|
||||
model = MatrixServiceProduct
|
||||
fields = ['uuid', 'order', 'owner', 'status', 'vm', 'domain', 'recurring_period']
|
||||
fields = ['uuid', 'order', 'owner', 'status', 'vm', 'domain',
|
||||
'recurring_period']
|
||||
read_only_fields = ['uuid', 'order', 'owner', 'status']
|
||||
|
||||
class GenericServiceProductSerializer(serializers.ModelSerializer):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue