示例#1
0
    def validate(self, data):
        sa = data.get('submission_agreement', getattr(self.instance, 'submission_agreement', None))
        instance_data = data.get('data', {})

        validate_template(sa.template, instance_data)
        data['data'] = instance_data
        return data
示例#2
0
    def validate(self, data):
        relation = data['relation']
        instance_data = data.get('data', {})

        if self.instance is None and relation.data is not None and instance_data == relation.data.data:
            raise serializers.ValidationError('No changes made')

        validate_template(relation.profile.template, instance_data)
        data['data'] = instance_data
        return data
示例#3
0
    def validate(self, data):
        relation = data['relation']
        instance_data = data.get('data', {})

        if self.instance is None and relation.data is not None and instance_data == relation.data.data:
            raise serializers.ValidationError('No changes made')

        filtered_data = {}
        extra_data = fill_specification_data(
            ip=relation.ip, sa=relation.ip.submission_agreement)
        for k, v in instance_data.items():
            if k not in extra_data:
                filtered_data[k] = v

        validate_template(relation.profile.template, filtered_data)
        data['data'] = filtered_data
        return data
示例#4
0
 def clean(self):
     data = getattr(self.data, 'data', {})
     data = fill_specification_data(data.copy(),
                                    ip=self.information_package,
                                    sa=self.submission_agreement)
     validate_template(self.submission_agreement.template, data)
示例#5
0
 def clean(self):
     data = getattr(self.data, 'data', {})
     data = fill_specification_data(data.copy(),
                                    ip=self.ip,
                                    sa=self.ip.submission_agreement)
     validate_template(self.profile.template, data)