def get_fields_of_form(self, report=None): fields_form_filter = SortedDict({}) fields_form_display = SortedDict({}) if report and report.options: report_options_order = get_ordered_fields(report) for field_name, opts in report_options_order: fields_form_filter, fields_form_display = self.get_field_of_form( field_name, opts, fields_form_filter=fields_form_filter, fields_form_display=fields_form_display) else: for field_name in self.get_report_filter_fields(): fields_form_filter, fields_form_display = self.get_field_of_form( field_name, default=True, fields_form_filter=fields_form_filter, fields_form_display=fields_form_display) for field_name in self.get_report_display_fields(): fields_form_filter, fields_form_display = self.get_field_of_form( field_name, default=False, fields_form_filter=fields_form_filter, fields_form_display=fields_form_display) return (fields_form_filter, fields_form_display)
def get_fields(search): model = search.content_type.model_class() fields_form_filter = SortedDict({}) fields_form_display = SortedDict({}) ordered_fields = get_ordered_fields(search) for field_name, opts in ordered_fields: model_field, field = get_field_from_model(model, field_name) adaptor = get_adaptor(field)(model_field, field, field_name) adaptor.get_field_form(opts, default=True, fields_form_filter=fields_form_filter, fields_form_display=fields_form_display) return fields_form_filter
def get_fields_of_form(self, report=None): fields_form_filter = SortedDict({}) fields_form_display = SortedDict({}) if report and report.options: report_options_order = get_ordered_fields(report) for field_name, opts in report_options_order: fields_form_filter, fields_form_display = self.get_field_of_form(field_name, opts, fields_form_filter=fields_form_filter, fields_form_display=fields_form_display) else: for field_name in self.get_report_filter_fields(): fields_form_filter, fields_form_display = self.get_field_of_form(field_name, default=True, fields_form_filter=fields_form_filter, fields_form_display=fields_form_display) for field_name in self.get_report_display_fields(): fields_form_filter, fields_form_display = self.get_field_of_form(field_name, default=False, fields_form_filter=fields_form_filter, fields_form_display=fields_form_display) return (fields_form_filter, fields_form_display)