Exemple #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
Exemple #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
Exemple #3
0
 def create(self, validated_data):
     validated_data['created_by'] = self.context['request'].user
     item = super(TaskSerializer, self).create(validated_data)
     user = item.user
     fields = get_fields_and_values(item)
     [n(item, user, fields).notify() for n in self.notifiers]
     StatusLog.create_status_log(item)
     return item
    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