def get_query_dict(self): """get_query_dict() -> QueryDict""" # We construct the mform to use its structure and prefix. We don't actually bind # data to the forms. mform = report_gen_views.report_form() mform.bind() res = django.http.QueryDict('', mutable=True) res.update(denormalize_formset_dict( self._data_dict['columns'], mform.columns, ReportDesign._COLUMN_ATTRS)) res.update(self._denormalize_union_mform(self._data_dict['union'], mform.union)) return res
def _denormalize_union_mform(self, data_dict, mform): """Returns a QueryDict""" res = django.http.QueryDict('', mutable=True) res.update(denormalize_form_dict(data_dict['bools'], mform.bool, ReportDesign._BOOL_ATTRS)) res.update(denormalize_formset_dict(data_dict['conds'], mform.conds, ReportDesign._COND_ATTRS)) subunion_dict_list = data_dict['subunions'] for i, subunion_dict in enumerate(subunion_dict_list): # Make a subform on the fly and denormalize that recursively name = '%s%d' % (report_gen_views.SUB_UNION_PREFIX, i) mform.add_subform(name, report_gen_views.UnionMultiForm) res.update(self._denormalize_union_mform(subunion_dict, getattr(mform, name))) res[mform.mgmt.add_prefix('next_form_id')] = str(len(subunion_dict_list)) return res
def get_query_dict(self): """get_query_dict() -> QueryDict""" # We construct the mform to use its structure and prefix. We don't actually bind # data to the forms. mform = report_gen_views.report_form() mform.bind() res = django.http.QueryDict('', mutable=True) res.update( denormalize_formset_dict(self._data_dict['columns'], mform.columns, ReportDesign._COLUMN_ATTRS)) res.update( self._denormalize_union_mform(self._data_dict['union'], mform.union)) return res
def _denormalize_union_mform(self, data_dict, mform): """Returns a QueryDict""" res = django.http.QueryDict('', mutable=True) res.update( denormalize_form_dict(data_dict['bools'], mform.bool, ReportDesign._BOOL_ATTRS)) res.update( denormalize_formset_dict(data_dict['conds'], mform.conds, ReportDesign._COND_ATTRS)) subunion_dict_list = data_dict['subunions'] for i, subunion_dict in enumerate(subunion_dict_list): # Make a subform on the fly and denormalize that recursively name = '%s%d' % (report_gen_views.SUB_UNION_PREFIX, i) mform.add_subform(name, report_gen_views.UnionMultiForm) res.update( self._denormalize_union_mform(subunion_dict, getattr(mform, name))) res[mform.mgmt.add_prefix('next_form_id')] = str( len(subunion_dict_list)) return res