コード例 #1
0
    def __init__(self):
        self.reqparse = reqparse.RequestParser()

        self.reqparse.add_argument(
        'course',
        required = True,
        help = 'No course provided',
        location = ['form', 'json'],
        type = inputs.positive
        )

        self.reqparse.add_argument(
        'rating',
        required = True,
        help = 'No rating provided',
        location = ['form', 'json'],
        type = inputs.int_range(1, 5)
        )

        self.reqparse.add_argument(
        'comment',
        required = False,
        nullable = True,
        location = ['form', 'json'],
        default = ''
        )

        super(ReviewList, self).__init__()
コード例 #2
0
ファイル: reviews.py プロジェクト: kashyap32/flask-REST
    def __init__(self):
        self.reqparse=reqparse.RequestParser()
        self.reqparse.add_argument(
            'course',
            type=inputs.positive,
            required=True,
            help="NO  course provided",
            location=['Form','json']
        )
        self.reqparse.add_argument(
            'rating',
            required=True,
            type=inputs.int_range(1,5),
            help="NO rating  provided",
            location=['Form','json'],

        )
        self.reqparse.add_argument(
            'comment',
            required=False,
            nullable=True,
            help="NO comment  provided",


        )
        super(Reviewlist,self).__init__()
コード例 #3
0
 def __init__(self):
     self.reqparse = reqparse.RequestParser()
     self.reqparse.add_argument('course',
         required=True,
         help='No course provided',
         location=['form', 'json'],
         type=inputs.positive)
     self.reqparse.add_argument('rating',
         required=True,
         help='No course rating provided',
         location=['form', 'json'],
         type=inputs.int_range(1, 5))
     self.reqparse.add_argument('comment',
         required=False,
         nullable=True,
         location=['form', 'json'],
         default='')
     super().__init__()