Exemple #1
0
 def post(self):
     headers = {'Content-Type': 'application/json'}
     args = parser.parse_args()
     content = args['content']
     dataset = args['dataset']
     creator = args['creator']
     dataset = Dataset.objects(id=dataset)
     creator = User.objects(id=creator)
     query = Query()
     query.content = content
     query.data_set = dataset[0]
     query.creator = creator[0]
     query.submitted = False
     query.save()
     return make_response(jsonify("succeed"), 200, headers)
Exemple #2
0
    def post(self):
        args = parser.parse_args()

        query_content = args['query']
        assignment_id = args['assignment_id']
        user_id = args['user_id']
        doc_scores = args['doc_scores']

        assignment = Assignment.objects(id=assignment_id).first()
        creator = User.objects(id=user_id).first()

        query = Query()
        query.content = query_content
        query.assignment = assignment
        query.doc_scores = doc_scores
        query.creator = creator
        query.submitted = False
        query.save()

        return "OK"