def semantic_results(cl): if cl.formset: for res, form in zip(cl.result_list, cl.formset.forms): yield ResultList(form, semantic_items_for_result(cl, res, form)) else: for res in cl.result_list: yield ResultList(None, semantic_items_for_result(cl, res, None))
def results(cl, user): # added parameter 'user' to function if cl.formset: for res, form in zip(cl.result_list, cl.formset.forms): yield ResultList(form, items_for_result(cl, res, form, user)) else: for res in cl.result_list: yield ResultList(None, items_for_result(cl, res, None, user))
def results(cl, website): if cl.formset: for res, form in zip(cl.result_list, cl.formset.forms): yield ResultList(form, chain(items_for_result(cl, res, form), custom_items_for_result(cl, res, website))) else: for res in cl.result_list: yield ResultList(None, chain(items_for_result(cl, res, None), custom_items_for_result(cl, res, website)))
def results(cl): """ Just like the one from Django. Only we add a serializable_value method to the document, because Django expects it and mongoengine doesn't have it. """ if cl.formset: for res, form in zip(cl.result_list, cl.formset.forms): patch_document(serializable_value, res) yield ResultList(form, items_for_result(cl, res, form)) else: for res in cl.result_list: patch_document(serializable_value, res) yield ResultList(None, items_for_result(cl, res, None))
def results(report): for res in report.result_list: yield ResultList(None, items_for_result(report, res)) if report.aggregate: aggregation_row = [] for field in report.grouper.group_value: aggregation_row.append(mark_safe(u'<td>%s</td>' % " ")) for title, value in report.get_aggregation(): result_repr = "%s: %s" % (title, value) aggregation_row.append( mark_safe(u'<td><strong>%s</strong></td>' % result_repr)) yield ResultList(None, aggregation_row)
def settings_list(cl): """ Displays the headers and data list together """ from django_settings.models import SettingSet headers = list(result_headers(cl)) num_sorted_fields = 0 for h in headers: if h['sortable'] and h['sorted']: num_sorted_fields += 1 # fake set for settings without setting set fake_setting_set_name = 'Unallocated' if hasattr(settings, 'DJANGO_SETTINGS_UNALLOCATED_SET'): fake_setting_set_name = settings.DJANGO_SETTINGS_UNALLOCATED_SET fake_setting_set = SettingSet(pk=0, title=fake_setting_set_name) setting_sets = {} for setting in cl.result_list: setting_set = setting.setting_set or fake_setting_set setting_sets.setdefault(setting_set, []) \ .append(ResultList(None, items_for_result(cl, setting, None))) return { 'cl': cl, 'result_hidden_fields': list(result_hidden_fields(cl)), 'result_headers': headers, 'num_sorted_fields': num_sorted_fields, 'results': setting_sets }
def results(report): for res in report.format_result_list(report.result_list): yield ResultList(None, items_for_result(report, res)) if report.aggregate: aggregation_row = [] for field in report.grouper.group_value: aggregation_row.append(mark_safe(u'<td>%s</td>' % " ")) aggregate_titles = [ mark_safe('<th>%s</th>' % t) for t in report.aggregate_titles ] yield ResultList(None, aggregation_row + aggregate_titles) for title, value in report.get_aggregation(): aggregation_row.append( mark_safe(u'<td><strong>%s</strong></td>' % value)) yield ResultList(None, aggregation_row)
def results_hubuser(cl): #for res in cl.result_list: #yield dict(pk=getattr(res, cl.pk_attname), field_list=list(items_for_result(cl,res))) # yield dict(field_list=list(items_for_result(cl, res, None))) #for res, form in zip(cl.result_list, cl.formset.forms): # yield ResultList(form, items_for_result(cl, res, form)) # for res, form in zip(cl.result_list, cl.formset.forms): # yield ResultList(form, items_for_result(cl, res, form)) # else: for res in cl.result_list: yield ResultList(None, items_for_result(cl, res, None))
def results(view, object_list, request): for item in object_list: yield ResultList(None, items_for_result(view, item, request))
def results(cl): for res in cl.result_list: yield ResultList(None, items_for_result(cl, res))