def _get_field_to_sort_on(post_dict, form_model, filter_type): order_by = int(post_dict.get('iSortCol_0')) - 1 header = HeaderFactory(form_model).create_header(filter_type) headers = header.get_header_field_names() try: #Remove extra meta fields with which ordering in submission values #and submission headers will not match headers.remove('ds_id') headers.remove('entity_short_code') except ValueError: pass return headers[order_by]
def query(self, database_name): query_all_results = self.query_builder.query_all( database_name, self.form_model.id) submission_type = self.query_params.get('filter') header = HeaderFactory(self.form_model).create_header(submission_type) submission_headers = header.get_header_field_names() query_by_submission_type = self.query_builder.filter_by_submission_type( query_all_results, self.query_params) filtered_query = self.query_builder.add_query_criteria( submission_headers, query_by_submission_type, self.query_params.get('search_filters').get('search_text'), query_params=self.query_params) submissions = self.response_creator.create_response( submission_headers, filtered_query) return submissions
def get_headers(self, user=None, entity_type=None): submission_type = self.query_params.get('filter') header = HeaderFactory(self.form_model).create_header(submission_type) return header.get_header_field_names()
def _get_query_fields(form_model, submission_type): header = HeaderFactory(form_model).create_header(submission_type) return header.get_header_field_names()