def get_query_dict(self): # We construct the form to use its structure and prefix. We don't actually bind data to the forms. from beeswax.forms import QueryForm mform = QueryForm() mform.bind() res = django.http.QueryDict('', mutable=True) res.update(denormalize_form_dict(self._data_dict['query'], mform.query, SparkDesign._QUERY_ATTRS)) return res
def get_query_dict(self): # We construct the mform to use its structure and prefix. We don't actually bind data to the forms. from beeswax.forms import QueryForm mform = QueryForm() mform.bind() res = django.http.QueryDict('', mutable=True) res.update(denormalize_form_dict( self._data_dict['query'], mform.query, SQLdesign._QUERY_ATTRS)) 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 _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