예제 #1
0
    def create(self, validated_data):
        """
        Returns object instances based on the validated data
        """
        request, username = get_request_and_username(self.context)
        submission = request.data.get('submission')
        # convert lists in submission dict to joined strings
        try:
            submission_joined = dict_paths2dict(dict_lists2strings(submission))
        except AttributeError:
            raise serializers.ValidationError(
                _(u'Incorrect format, see format details here,'
                  u'https://api.ona.io/static/docs/submissions.html.'))

        instance = create_submission(request, username, submission_joined,
                                     request.data.get('id'))

        return instance
예제 #2
0
    def create(self, validated_data):
        """
        Returns object instances based on the validated data
        """
        request, username = get_request_and_username(self.context)
        submission = request.data.get('submission')
        # convert lists in submission dict to joined strings
        try:
            submission_joined = dict_paths2dict(dict_lists2strings(submission))
        except AttributeError:
            raise serializers.ValidationError(
                _(u'Incorrect format, see format details here,'
                  u'https://api.ona.io/static/docs/submissions.html.'))

        instance = create_submission(request, username, submission_joined,
                                     request.data.get('id'))

        return instance