예제 #1
0
 def update(self, instance, validated_data):
     initial_data = get_fields_and_values(instance)
     item = super(WorkItemSerializer, self).update(instance, validated_data)
     updated_data = get_fields_and_values(item)
     updated_fields = get_changed_fields(initial_data, updated_data)
     [n(item, updated_data, updated_fields).update_notify() for n in self.notifiers]
     return item
예제 #2
0
 def update(self, instance, validated_data):
     initial_data = get_fields_and_values(instance)
     item = super(TaskSerializer, self).update(instance, validated_data)
     user = item.user
     updated_data = get_fields_and_values(item)
     updated_fields = get_changed_fields(initial_data, updated_data)
     current_user = self.context['request'].user
     [n(item, user, updated_data, updated_fields).update_notify() for n in self.notifiers]
     return item
예제 #3
0
    def update(self, instance, validated_data):
        initial_data = get_fields_and_values(instance)
        item = super(TaskSerializer, self).update(instance, validated_data)
        user = item.user
        status = validated_data['status']
        project_owner = validated_data['project'].owner

        if status == 'review':
            item.send_review_notification()
        elif status == 'rework':
            item.send_rework_notification()

        updated_data = get_fields_and_values(instance)
        fields = get_changed_fields(initial_data, updated_data)

        if 'user' in fields:
            item.send_notification_assigned()
        if 'status' in fields:
            StatusLog.create_status_log(item)

        return item