def perform_update(self, serializer): previous_state = self.get_object() credit_trade = serializer.save() CreditTradeService.create_history(credit_trade, False) status_cancelled = CreditTradeStatus.objects.get(status="Cancelled") if serializer.data['status'] != status_cancelled.id: CreditTradeService.dispatch_notifications(previous_state, credit_trade)
def perform_update(self, serializer): credit_trade = serializer.save() CreditTradeService.create_history(credit_trade, False)
def perform_create(self, serializer): credit_trade = serializer.save() CreditTradeService.create_history(credit_trade, True) CreditTradeService.dispatch_notifications(None, credit_trade)