def report_quick(self, request):
        fields = list(getattr(self, 'list_display', ('__unicode__', )))
        filters = Q()
        ordering = self.ordering
        if request.GET.get('q', None):
            filters = set_filters_search_fields(self, request, filters, self.model)
        if request.GET.get('o', None):
            ordering = list(fields)[int(request.GET.get('o', None))]
            if request.GET.get('ot', None) and request.GET.get('ot') == 'desc':
                ordering = '-%s' % ordering
            ordering = (ordering, )
        queryset = self.queryset(request)

        try:
            try:
                cl = ChangeList(request, self.model, self.list_display, self.list_display_links, self.list_filter,
                    self.date_hierarchy, self.search_fields, self.list_select_related, self.list_per_page, self)
            except TypeError:
                cl = ChangeList(request, self.model, self.list_display, self.list_display_links, self.list_filter,
                    self.date_hierarchy, self.search_fields, self.list_select_related, self.list_per_page, self.list_editable, self)
            headers = list(result_headers(cl))
            j = 0
            for i, header in enumerate(headers):
                if not header.get('url', None) and isinstance(fields[i - j], basestring) and not getattr(self.model, fields[i - j], None):
                    del fields[i - j]
                    j = j + 1
        except IncorrectLookupParameters:
            pass

        return reports_view(request, self.model._meta.app_label, self.model._meta.module_name,
                            fields=fields, list_headers=None, ordering=ordering, filters=filters,
                            api=self, queryset=queryset,
                            report_to='csv')
def cockpit_page_result_list(cl):
    """
    Displays the headers and data list together
    Replaces admin template tag "result_list". Constructs page list according to the
    hierarchical structure.
    """
    headers = list(result_headers(cl))
    num_sorted_fields = 0
    for h in headers:
        if h['sortable'] and h['sorted']:
            num_sorted_fields += 1

    page_results = cl.result_list
    ordered_results = create_ordered_page_list(page_results)
    cl.result_list = ordered_results['ordered_list']
    hierarchy_levels = ordered_results['hierarchy_levels']
    list_results = list(results(cl))

    # Hierarchical indentation
    i = 0
    for result in list_results:
        result[1] = remove_tags(result[1], "th")
        result[1] = mark_safe(u"<th style='padding-left: %dpx;'>%s</th>" % (5 + hierarchy_levels[i] * 20, result[1]))
        i += 1
    return {'cl': cl,
            'result_hidden_fields': list(result_hidden_fields(cl)),
            'result_headers': headers,
            'num_sorted_fields': num_sorted_fields,
            'results': list_results}
def qe_result_list(context, cl):
    from django.conf import settings
    return {'cl': cl,
            'result_hidden_fields': list(result_hidden_fields(cl)),
            'result_headers': list(result_headers(cl)),
            'results': list(results(cl)),
            'STATIC_URL': context['STATIC_URL']}
def result_list(context, view, object_list, form_action):
    """
    Displays the headers and data list together
    """
    obj = object_list[0]
    app_label = obj.__class__.__dict__['__module__'].split('.')[0]

    from django.forms import modelformset_factory
    from importlib import import_module
    try:
        form = getattr(import_module(app_label + '.forms'), 'Wagtail' + obj.__class__.__name__ + 'Form')
    except (AttributeError, ImportError):
        form = None
    if form:
        ObjectFormSet = modelformset_factory(obj.__class__, form=form, extra=0)
        formset =  ObjectFormSet(queryset=object_list)
        context.update({
            'formset': formset,
            'zipped': zip(list(results(view, object_list)), formset),
        })

    headers = list(result_headers(view))
    num_sorted_fields = 0
    for h in headers:
        if h['sortable'] and h['sorted']:
            num_sorted_fields += 1
    context.update({
        'result_headers': headers,
        'num_sorted_fields': num_sorted_fields,
        'results': list(results(view, object_list)),
        'form_action': form_action,
    })

    return context
def qe_result_list(context, cl):
    return {
        'qe_fields': cl.model_admin.quick_editable,
        'cl': cl,
        'result_headers': list(result_headers(cl)),
        'results': list(results(cl,context['request'])),
    }
Example #6
0
def mptt_result_list(cl):
    """
    Displays the headers and data list together
    """
    return {'cl': cl,
            'result_headers': list(result_headers(cl)),
            'results': list(mptt_results(cl))}
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}
Example #8
0
def breadcrumb_result_list(cl):
    """
    Displays the headers and data list together
    """
    return {'cl': cl,
            'result_hidden_fields': list(result_hidden_fields(cl)),
            'result_headers': list(result_headers(cl)),
            'results': list(breadcrumb_results(cl))}
def result_list(context):
    """
    Displays the headers and data list together
    """
    cl = context['cl']
    return {'cl': cl,
            'result_headers': result_headers(cl),
            'results': results(cl),
            'export_delimiter' : context['export_delimiter'],
           }
Example #10
0
def qe_result_list(context, cl):
    if context.has_key('STATIC_URL'):
        static_url = 'STATIC_URL'
    else:
        static_url = 'MEDIA_URL'
    return {'cl': cl,
            'result_hidden_fields': list(result_hidden_fields(cl)),
            'result_headers': list(result_headers(cl)),
            'results': list(results(cl)),
            'STATIC_URL': context[static_url]}
Example #11
0
def result_linked_list(cl):
  headers = list(result_headers(cl))
  num_sorted_fields = 0
  for h in headers:
    if h['sortable'] and h['sorted']:
      num_sorted_fields += 1
  return {'cl': cl,
    'result_hidden_fields': list(result_hidden_fields(cl)),
    'result_headers': headers,
    'num_sorted_fields': num_sorted_fields,
    'results': list(results(cl))}
def result_list(context):
    """
    Displays the headers and data list together
    """
    cl = context["cl"]
    return {
        "cl": cl,
        "result_headers": list(result_headers(cl)),
        "results": list(results(cl)),
        "export_delimiter": context["export_delimiter"],
    }
Example #13
0
def report_result_list(report):
    headers = list(result_headers(report))
    num_sorted_fields = 0
    for h in headers:
        if h['sortable'] and h['sorted']:
            num_sorted_fields += 1
    return {'cl': report,
            'result_hidden_fields': [],
            'result_headers': headers,
            'num_sorted_fields': num_sorted_fields,
            'results': list(results(report))}
Example #14
0
def qe_result_list(context, cl):
    if context.has_key("STATIC_URL"):
        static_url = "STATIC_URL"
    else:
        static_url = "MEDIA_URL"
    return {
        "cl": cl,
        "result_headers": list(result_headers(cl)),
        "results": list(results(cl)),
        "STATIC_URL": context[static_url],
    }
def result_tree_list(cl):
    """
    Displays the headers and data list together
    """
    import django
    result = {'cl': cl,
            'result_headers': list(result_headers(cl)),
            'results': list(tree_results(cl))}
    if django.VERSION[1] > 2:
        from django.contrib.admin.templatetags.admin_list import result_hidden_fields
        result['result_hidden_fields'] = list(result_hidden_fields(cl))
    return result
Example #16
0
def report_result_list(report):
    headers = list(result_headers(report))
    num_sorted_fields = 0
    for h in headers:
        if h["sortable"] and h["sorted"]:
            num_sorted_fields += 1
    return {
        "cl": report,
        "result_hidden_fields": [],
        "result_headers": headers,
        "num_sorted_fields": num_sorted_fields,
        "results": list(results(report)),
    }
def result_list(context, view, object_list):
    """
    Displays the headers and data list together
    """
    headers = list(result_headers(view))
    num_sorted_fields = 0
    for h in headers:
        if h["sortable"] and h["sorted"]:
            num_sorted_fields += 1
    context.update(
        {"result_headers": headers, "num_sorted_fields": num_sorted_fields, "results": list(results(view, object_list))}
    )
    return context
Example #18
0
def feed_result_list(context, cl):
    if not hasattr(cl, 'request') and 'request' in context:
        cl.request = context['request']
    header_list = list(result_headers(cl))
    act =   {"text": "action",
               "sortable": False,
               "url": "",
               "class_attrib": "action_header"}

    header_list.append(act)
    return {'cl': cl,
            'result_headers': header_list,
            'results': list(feed_results(cl))}
Example #19
0
    def __init__(self, ofile, cl, logo=None, date='Today', header=None, footer=None, pagesize=A4, logo_x=.5*cm, logo_y=7*cm, logo_size=1.2*cm):
        super(StarmatoPDFList, self).__init__(ofile, logo, date, header, footer, pagesize)

        self.cl = cl
        self.headers = list(result_headers(cl))
        self.p.setLineWidth(0.5)
        self.line_height = 1
        self.logo_x = logo_x
        self.logo_y = logo_y
        self.logo_size = logo_size
        self.draw_logo()
        self.draw_footer()
        self.draw_header()
def mptt_result_list(cl):
    """
    Displays the headers and data list together
    """
    headers = list(result_headers(cl))
    num_sorted_fields = 0
    for h in headers:
        if h['sortable'] and h['sorted']:
            num_sorted_fields += 1
    return {'cl': cl,
            'result_hidden_fields': list(result_hidden_fields(cl)),
            'result_headers': headers,
            'num_sorted_fields': num_sorted_fields,
            'results': list(mptt_results(cl))}
def extended_result_list(cl, additional_links):
    """
    Rewrite of original function to add an additional columns after each result
    in the change list.
    """
    headers = list(result_headers(cl))
    for header in additional_links:
        headers.append(header)

    return {
        'cl': cl,
        'result_headers': headers,
        'results': list(results(cl, additional_links))
    }
def result_list(context, view, object_list):
    """
    Displays the headers and data list together
    """
    headers = list(result_headers(view))
    num_sorted_fields = 0
    for h in headers:
        if h['sortable'] and h['sorted']:
            num_sorted_fields += 1
    context.update({
        'result_headers': headers,
        'num_sorted_fields': num_sorted_fields,
        'results': list(results(view, object_list))})
    return context
Example #23
0
def color_result_list(cl):
    """
    Displays the headers and data list together
    """
    headers = list(admin_list.result_headers(cl))
    num_sorted_fields = 0
    for h in headers:
        if h["sortable"] and h["sorted"]:
            num_sorted_fields += 1
    return {
        "cl": cl,
        "result_hidden_fields": list(admin_list.result_hidden_fields(cl)),
        "result_headers": headers,
        "num_sorted_fields": num_sorted_fields,
        "results": list(my_results(cl)),
    }
def editregion_result_list(cl):
    """
    This literally only exists to change the template and fix it properly.
    """
    headers = list(result_headers(cl))
    num_sorted_fields = 0
    for h in headers:  # pragma: no cover .. this was just copypasted from Django
        if h["sortable"] and h["sorted"]:
            num_sorted_fields += 1
    return {
        "cl": cl,
        "result_hidden_fields": list(result_hidden_fields(cl)),
        "result_headers": headers,
        "num_sorted_fields": num_sorted_fields,
        "results": list(results(cl)),
    }
Example #25
0
    def render(self, context):
        cl = Variable(self.cl).resolve(context)
        
        cat_id = context['request'].GET.get('category__id__exact')
        if cat_id:
            # positions = cl.model.positions.get(id=cat_id)
            position_model = cl.model.positions.related.model
            positions = position_model.objects.filter(category=cat_id, related_model__in=cl.result_list).order_by('sort_order')
            cl.result_list = [position.related_model for position in positions]

        return loader.render_to_string("admin/change_list_results.html", {
            'cl': cl,
            'result_hidden_fields': list(result_hidden_fields(cl)),
            'result_headers': list(result_headers(cl)),
            'results': list(results(cl))}
            )
def supertaggeditem_result_list(cl):
    """
    Displays special non-selectable tag list for an item.
    """
    from django.contrib.admin.templatetags.admin_list import result_headers
    try:
        from django.contrib.admin.templatetags.admin_list import result_hidden_fields
    except ImportError:
        result_hidden_fields = lambda x: []
    
    headers = list(result_headers(cl))
    cl.list_editable = cl.model_admin.list_editable
    return {'cl': cl,
            'result_hidden_fields': list(result_hidden_fields(cl)),
            'result_headers': headers,
            'reset_sorting_url': cl.get_query_string(remove=[ORDER_VAR]),
            'results': list(results(cl))}
def document_result_list(cl):
    """
    Displays the headers and data list together
    """
    headers = list(result_headers(cl))
    try:
        num_sorted_fields = 0
        for h in headers:
            if h['sortable'] and h['sorted']:
                num_sorted_fields += 1
    except KeyError:
        pass

    return {'cl': cl,
            'result_hidden_fields': list(result_hidden_fields(cl)),
            'result_headers': headers,
            'num_sorted_fields': num_sorted_fields,
            'results': list(results(cl))}
Example #28
0
def result_list(cl):
    """
    Copy/pasted from django.contrib.admin.templatetags.admin_list just so I can
    modify the value passed to `.inclusion_tag()` in the decorator here.  There
    must be a cleaner way... right?
    """
    headers = list(result_headers(cl))
    num_sorted_fields = 0
    for h in headers:
        if h['sortable'] and h['sorted']:
            num_sorted_fields += 1
    return {
        'cl': cl,
        'result_hidden_fields': list(result_hidden_fields(cl)),
        'result_headers': headers,
        'num_sorted_fields': num_sorted_fields,
        'results': map(add_doc_edit_url, results(cl))
    }
Example #29
0
 def get_changelist_sort_links(self):
     links = list()
     changelist = self.state['changelist']
     from django.contrib.admin.templatetags.admin_list import result_headers
     for header in result_headers(changelist):
         if header.get("sortable", False):
             prompt = unicode(header["text"])
             classes = ["sortby"]
             if "url" in header:
                 links.append(self.get_link(url=header["url"], prompt=prompt, classes=classes+["primary"], rel="sortby"))
             else:
                 if header["ascending"]:
                     classes.append("ascending")
                 if header["sorted"]:
                     classes.append("sorted")
                 links.append(self.get_link(url=header["url_primary"], prompt=prompt, classes=classes+["primary"], rel="sortby"))
                 links.append(self.get_link(url=header["url_remove"], prompt=prompt, classes=classes+["remove"], rel="sortby"))
                 links.append(self.get_link(url=header["url_toggle"], prompt=prompt, classes=classes+["toggle"], rel="sortby"))
     return links
Example #30
0
 def get_changelist_sort_links(self):
     links = list()
     changelist = self.get_changelist()
     from django.contrib.admin.templatetags.admin_list import result_headers
     for header in result_headers(changelist):
         if header.get("sortable", False):
             prompt = unicode(header["text"])
             classes = ["sortby"]
             if "url" in header:
                 links.append(Link(url=header["url"], prompt=prompt, classes=classes+["primary"], rel="sortby"))
             else:
                 if header["ascending"]:
                     classes.append("ascending")
                 if header["sorted"]:
                     classes.append("sorted")
                 links.append(Link(url=header["url_primary"], prompt=prompt, classes=classes+["primary"], rel="sortby"))
                 links.append(Link(url=header["url_remove"], prompt=prompt, classes=classes+["remove"], rel="sortby"))
                 links.append(Link(url=header["url_toggle"], prompt=prompt, classes=classes+["toggle"], rel="sortby"))
     return links
def board_result_list(cl):
    """
    Displays the headers and data list together
    """
    css = list(result_css(cl))
    headers = list(admin_list.result_headers(cl))
    num_sorted_fields = 0
    results = list(admin_list.results(cl))
    for h in headers:
        if h["sortable"] and h["sorted"]:
            num_sorted_fields += 1
    return {
        "cl": cl,
        "css": css,
        "result_hidden_fields": list(admin_list.result_hidden_fields(cl)),
        "result_headers": headers,
        "num_sorted_fields": num_sorted_fields,
        "results": results,
    }
Example #32
0
def result_list(context):
    """
    Displays the headers and data list together
    """
    view = context['view']
    object_list = context['object_list']
    headers = list(result_headers(view))
    num_sorted_fields = 0
    for h in headers:
        if h['sortable'] and h['sorted']:
            num_sorted_fields += 1
    context.update({
        'result_headers':
        headers,
        'num_sorted_fields':
        num_sorted_fields,
        'results':
        list(results(view, object_list, context['request']))
    })
    return context
def project_result_list(cl):
    headers = list(result_headers(cl))
    headers.append({'text': mark_safe('&nbsp;')})

    results = list()

    for project in cl.result_list:
        rl = list(items_for_result(cl,project,None))

        url = reverse('admin_project_sendcredentials', args=[project.projectname])
        content = mark_safe('<td><a href="%s">Send Credentials</a></td>' % url)

        rl.append(content)
        results.append(rl)

    return {
        'cl': cl,
        'result_headers': headers,
        'results': results
    }
def document_result_list(cl):
    """
    Displays the headers and data list together
    """
    headers = list(result_headers(cl))
    try:
        num_sorted_fields = 0
        for h in headers:
            if h["sortable"] and h["sorted"]:
                num_sorted_fields += 1
    except KeyError:
        pass

    return {
        "cl": cl,
        "result_hidden_fields": list(result_hidden_fields(cl)),
        "result_headers": headers,
        "num_sorted_fields": num_sorted_fields,
        "results": list(results(cl)),
    }
Example #35
0
def result_list(context):
    """
    Displays the headers and data list together
    """
    view = context["view"]
    object_list = context["object_list"]
    headers = list(result_headers(view))
    num_sorted_fields = 0
    for h in headers:
        if h["sortable"] and h["sorted"]:
            num_sorted_fields += 1
    context.update({
        "result_headers":
        headers,
        "num_sorted_fields":
        num_sorted_fields,
        "results":
        list(results(view, object_list, context["request"])),
    })
    return context
Example #36
0
def document_result_list(cl):
    """
    Displays the headers and data list together
    """
    headers = list(result_headers(cl))
    try:
        num_sorted_fields = 0
        for h in headers:
            if h['sortable'] and h['sorted']:
                num_sorted_fields += 1
    except KeyError:
        pass

    return {
        'cl': cl,
        'result_hidden_fields': list(result_hidden_fields(cl)),
        'result_headers': headers,
        'num_sorted_fields': num_sorted_fields,
        'results': list(results(cl))
    }
Example #37
0
def my_result_list(cl):
    headers = list(result_headers(cl))
    num_sorted_fields = 0
    for h in headers:
        if h['sortable'] and h['sorted']:
            num_sorted_fields += 1

    rl = list(results(cl))
    for i in range(len(rl)):
        for j in range(1,len(rl[i])):
            rl[i][j] = mark_safe(rl[i][j].replace(
                '<a ','<a class="btn-link" ').replace(
                '<th class="','<th style="vertical-align:middle" class="text-center ').replace(
                '<td class="','<td style="vertical-align:middle" class="')
                )

    return {'cl': cl,
            'result_hidden_fields': list(result_hidden_fields(cl)),
            'result_headers': headers,
            'num_sorted_fields': num_sorted_fields,
            'results': rl,}
def totalsum_result_list(context, cl, totals, unit_of_measure, template_name="totalsum_change_list_results.html"):

    pagination_required = (not cl.show_all or not cl.can_show_all) and cl.multi_page
    headers = list(result_headers(cl))
    num_sorted_fields = 0
    for h in headers:
        if h['sortable'] and h['sorted']:
            num_sorted_fields += 1
    c = {
        'cl': cl,
        'totals': totals,
        'unit_of_measure': unit_of_measure,
        'result_hidden_fields': list(result_hidden_fields(cl)),
        'result_headers': headers,
        'num_sorted_fields': num_sorted_fields,
        'results': list(results(cl)),
        'pagination_required': pagination_required
    }

    t = loader.get_template(template_name)
    return t.render(c)
Example #39
0
def result_sortable_list(cl):
    """
    Displays the headers and data list together
    """
    if not cl.params.get('o', None):
        # Disable sortable when admin filter data from result table according to fields
        from ..models import Sortable
        cl.result_list = Sortable.get_sortable_row(cl.opts.model_name,
                                                   cl.result_list)
    headers = list(result_headers(cl))
    num_sorted_fields = 0
    for h in headers:
        if h['sortable'] and h['sorted']:
            num_sorted_fields += 1
    return {
        'cl': cl,
        'result_hidden_fields': list(result_hidden_fields(cl)),
        'result_headers': headers,
        'num_sorted_fields': num_sorted_fields,
        'results': list(results(cl))
    }
def stylable_result_headers(cl):
    """
    Reuse the existing result_headers() iterator,
    and add a `col-FIELD_NAME` class to the header, and fieldname to assist JavaScript
    cl = The django ChangeList object
    """
    for field_name, header in zip(cl.list_display, result_headers(cl)):
        header['field_name'] = field_name  # For JavaScript

        if header.get('class_attrib'):
            # Remove any sorting marker for mptt tables, because they are not sortable.
            if hasattr(cl.model, '_mptt_meta'):
                header['class_attrib'] = header['class_attrib'].replace('sortable', '').replace('sorted', '').replace('ascending', '')

            header['class_attrib'] = mark_safe(header['class_attrib'].replace('class="', 'class="col-%s ' % field_name))
        else:
            header['class_attrib'] = mark_safe(' class="col-%s"' % field_name)

        if 'url_primary' in header and 'url' not in header:
            header['url'] = header['url_primary']  # Django 1.3 template compatibility.

        yield header
Example #41
0
def result_tree(context, cl, request):
    """
    Added 'filtered' param, so the template's js knows whether the results have
    been affected by a GET param or not. Only when the results are not filtered
    you can drag and sort the tree
    """

    # Here I'm adding an extra col on pos 2 for the drag handlers
    headers = list(result_headers(cl))
    headers.insert(1 if needs_checkboxes(context) else 0, {
        'text': '+',
        'sortable': True,
        'url': request.path,
        'tooltip': _('Return to ordered tree'),
        'class_attrib': mark_safe(' class="oder-grabber"')
    })
    return {
        'filtered': not check_empty_dict(request.GET),
        'result_hidden_fields': list(result_hidden_fields(cl)),
        'result_headers': headers,
        'results': list(results(cl)),
    }
Example #42
0
def result_tree(cl, request):
    """
    Added 'filtered' param, so the template's js knows whether the results have
    been affected by a GET param or not. Only when the results are not filtered
    you can drag and sort the tree
    """

    # Here I'm adding an extra col on pos 2 for the drag handlers
    headers = list(result_headers(cl))
    headers.insert(
        1, {
            'text': '+',
            'sortable': True,
            'url': request.path,
            'tooltip': u'Return to ordered Tree',
        })
    return {
        'filtered': not check_empty_dict(request.GET),
        'result_hidden_fields': list(result_hidden_fields(cl)),
        'result_headers': headers,
        'results': list(results(cl)),
    }
Example #43
0
def common_result_list(cl,
                       totals=None,
                       unit_of_measure='',
                       namespace='common'):
    """
    Displays the headers and data list together
    totals: contains totals for certain columns
    unit_of_measure: just symbols for those totals
    """
    headers = list(result_headers(cl))
    num_sorted_fields = 0
    for h in headers:
        if h['sortable'] and h['sorted']:
            num_sorted_fields += 1
    return {
        'cl': cl,
        'result_hidden_fields': list(result_hidden_fields(cl)),
        'result_headers': headers,
        'num_sorted_fields': num_sorted_fields,
        'totals': totals,
        'unit_of_measure': unit_of_measure,
        'results': list(_results(cl, namespace))
    }
Example #44
0
    def __init__(self,
                 ofile,
                 cl,
                 logo=None,
                 date='Today',
                 header=None,
                 footer=None,
                 pagesize=A4,
                 logo_x=.5 * cm,
                 logo_y=7 * cm,
                 logo_size=1.2 * cm):
        super(StarmatoPDFList, self).__init__(ofile, logo, date, header,
                                              footer, pagesize)

        self.cl = cl
        self.headers = list(result_headers(cl))
        self.p.setLineWidth(0.5)
        self.line_height = 1
        self.logo_x = logo_x
        self.logo_y = logo_y
        self.logo_size = logo_size
        self.draw_logo()
        self.draw_footer()
        self.draw_header()
Example #45
0
def result_list(cl):
    """
    Display the headers and data list together.
    """
    headers = list(result_headers(cl))
    result = list(results(cl))
    count = 0
    for item in result:
        count_tag = item[-1]
        if count_tag.find('field-count') != -1:
            count = count + int(re.search('\d+', count_tag).group())
    if count > 0:
        headers[-1]['text'] = headers[-1]['text'] + '(本页共计' + str(count) + '份)'
    num_sorted_fields = 0
    for h in headers:
        if h['sortable'] and h['sorted']:
            num_sorted_fields += 1
    return {
        'cl': cl,
        'result_hidden_fields': list(result_hidden_fields(cl)),
        'result_headers': headers,
        'num_sorted_fields': num_sorted_fields,
        'results': result,
    }
Example #46
0
def boss_result(cl):
    return {
        'cl': cl,
        'result_headers': list(result_headers(cl)),
        'results': list(mptt_results(cl))
    }
Example #47
0
def result_list_pending(cl):
    return {
        'cl': cl,
        'result_headers': list(admin_list.result_headers(cl)),
        'results': list(results_pending(cl))
    }
Example #48
0
def result_list_hubuser(cl):
    return {
        'cl': cl,
        'result_headers': list(result_headers(cl)),
        'results': list(results_hubuser(cl))
    }
Example #49
0
def article_result_list(cl):
    return {'cl': cl,
            'result_hidden_fields': list(result_hidden_fields(cl)),
            'result_headers': list(result_headers(cl)),
            'results': zip(cl.result_list,list(results(cl)))}
Example #50
0
def result_list_multidelete(cl):
    return {
        'cl': cl,
        'result_headers': list(result_headers(cl)),
        'results': list(results_multidelete(cl))
    }
Example #51
0
def _result_list(cl):
    return {
        'cl': cl,
        'result_headers': list(result_headers(cl)),
        'results': list(cl.result_list)  #list(results(cl))
    }
Example #52
0
def newman_result_list(cl):
    return {
        'cl': cl,
        'result_headers': list(result_headers(cl)),
        'results': list(results(cl))
    }
Example #53
0
def test_admin_order_field_result_headers_templatetag(modelclschangelist):
    results = tuple(result_headers(cl=modelclschangelist))
    assert len(results) == 2
    assert results[1]['sortable'] is True
Example #54
0
def result_list(cl):
    return {
        'cl': cl,
        'result_headers': list(result_headers(cl)),
        'results': list(better_results(cl))
    }
Example #55
0
 def __init__(self, request, cl):
     self.request = request
     self.cl = cl
     self.headers = list(admin_list.result_headers(cl))
     self.hidden_fields = list(admin_list.result_hidden_fields(cl))