コード例 #1
0
ファイル: order.py プロジェクト: awesto/django-shop
 def change_view(self, request, object_id, form_url='', extra_context=None):
     assert object_id, "An Order object can not be added through the Django-Admin"
     current_status = self.get_object(request, object_id).status
     response = super(BaseOrderAdmin, self).change_view(request, object_id, form_url, extra_context)
     order = self.get_object(request, object_id)
     if current_status != order.status:
         transition_change_notification(order)
     return response
コード例 #2
0
 def change_view(self, request, object_id, form_url='', extra_context=None):
     assert object_id, "An Order object can not be added through the Django-Admin"
     current_status = self.get_object(request, object_id).status
     response = super().change_view(request, object_id, form_url, extra_context)
     order = self.get_object(request, object_id)
     if current_status != order.status:
         transition_change_notification(order)
     return response
コード例 #3
0
ファイル: order.py プロジェクト: latticet/django-shop
    def save(self, with_notification=False, **kwargs):
        """
        :param with_notification: If ``True``, all notifications for the state of this Order object
        are executed.
        """
        from shop.transition import transition_change_notification

        auto_transition = self._auto_transitions.get(self.status)
        if callable(auto_transition):
            auto_transition(self)

        # round the total to the given decimal_places
        self._subtotal = BaseOrder.round_amount(self._subtotal)
        self._total = BaseOrder.round_amount(self._total)
        super(BaseOrder, self).save(**kwargs)
        if with_notification:
            transition_change_notification(self)
コード例 #4
0
ファイル: order.py プロジェクト: awesto/django-shop
    def save(self, with_notification=False, **kwargs):
        """
        :param with_notification: If ``True``, all notifications for the state of this Order object
        are executed.
        """
        from shop.transition import transition_change_notification

        auto_transition = self._auto_transitions.get(self.status)
        if callable(auto_transition):
            auto_transition(self)

        # round the total to the given decimal_places
        self._subtotal = BaseOrder.round_amount(self._subtotal)
        self._total = BaseOrder.round_amount(self._total)
        super(BaseOrder, self).save(**kwargs)
        if with_notification:
            transition_change_notification(self)