'uv': int, 'click': int, } required_fields = [ 'date', 'location', 'version', 'uv', 'click' ] default_values = { 'network': u'TYPE_00', 'action': u'action_00', 'label': u'label_00', } #def validate(self, *args, **kwargs): # if self['type'] == 0 and not self.get('content'): # raise ValueError('content should not be empty when type==0') # super(Feedback, self).validate(*args, **kwargs) if __name__ == '__main__': model_list = [Report, ] app_conf = {} barracks_app = Barracks('test') barracks_app.init_conf(app_conf, model_list, debug=True) # barracks_app.add_data(Feedback, { # '_id': 1, 'type': 2, 'newsId': 'FAKE', # 'relatedIds': '', 'locale': 'zh-cnj', 'phonePixels': '1280,800'}) # print barracks_app.get_data( # Feedback, {'filters': [{'name': '_id', 'op': '==', 'val': 1}]}) # barracks_app.del_data(Feedback, {'filters': [ # {'name': '_id', 'op': '==', 'val': 1}]}) barracks_app.run(port=5002)