forked from uncloud/uncloud
Move Order.add_record to save hook in abstract Product
This commit is contained in:
parent
ff133e81b7
commit
a7e9f3c09d
3 changed files with 14 additions and 31 deletions
|
|
@ -127,11 +127,6 @@ class VMProductViewSet(ProductViewSet):
|
|||
# Create VM.
|
||||
vm = serializer.save(owner=request.user, order=order)
|
||||
|
||||
# Add Product record to order (VM is mutable, allows to keep history in order).
|
||||
# XXX: Move this to some kind of on_create hook in parent Product class?
|
||||
order.add_record(vm.one_time_price,
|
||||
vm.recurring_price(order.recurring_period), vm.description)
|
||||
|
||||
return Response(serializer.data)
|
||||
|
||||
|
||||
|
|
@ -215,9 +210,4 @@ class DCLCreateVMProductViewSet(ProductViewSet):
|
|||
# Create VM.
|
||||
vm = serializer.save(owner=request.user, order=order)
|
||||
|
||||
# Add Product record to order (VM is mutable, allows to keep history in order).
|
||||
# XXX: Move this to some kind of on_create hook in parent Product class?
|
||||
order.add_record(vm.one_time_price,
|
||||
vm.recurring_price(order.recurring_period), vm.description)
|
||||
|
||||
return Response(serializer.data)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue