コード例 #1
0
ファイル: quickedit.py プロジェクト: ikresoft/django-content
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']}
コード例 #2
0
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
    }
コード例 #3
0
ファイル: totalsum.py プロジェクト: Anusha-A-R/inventory
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)
コード例 #4
0
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)
コード例 #5
0
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}
コード例 #6
0
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}
コード例 #7
0
def mptt_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(mptt_results(cl))}
コード例 #8
0
def result_tree(cl):
    tree_results(cl)    
    tree_result_headers(cl)   
 
    return {'cl': cl,
            'result_hidden_fields': list(result_hidden_fields(cl)),
            'result_headers': list(tree_result_headers(cl)),
            'results': list(tree_results(cl))}
コード例 #9
0
ファイル: mptt_admin.py プロジェクト: shultais/django-mptt
def mptt_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(mptt_results(cl))}
コード例 #10
0
ファイル: quickedit.py プロジェクト: digicase/django-stories
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]}
コード例 #11
0
def real_estate_app_result_list(cl,is_tag=False):
    """
        Custom result list can used with templatetags.
        cl = ChangeList
        is_tag = True or False, this is used to mount a url link.
    """
    return {'cl': cl,
            'result_hidden_fields': list(result_hidden_fields(cl)),
            'result_headers': list(result_headers(cl)),
            'results': list(results(cl,is_tag))}
コード例 #12
0
def mptt_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(mptt_results(cl)),
    }
コード例 #13
0
def tree_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(tree_results(cl)),
        'nodes': nodes_results(cl)
    }
コード例 #14
0
def 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
    return {'cl': cl,
            'result_hidden_fields': list(result_hidden_fields(cl)),
            'result_headers': headers,
            'num_sorted_fields': num_sorted_fields,
            'results': list(results(cl))}
コード例 #15
0
ファイル: results.py プロジェクト: papenx/DB_Football
def result_list_new(cl):
    """
    Display the headers and data list together.
    """
    headers = list(result_headers(cl))
    return {
        'cl': cl,
        'result_hidden_fields': list(result_hidden_fields(cl)),
        'result_headers': headers,
        'results': list(results(cl))
    }
コード例 #16
0
ファイル: admin.py プロジェクト: GSokol/meeetaggsmilk
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))}
コード例 #17
0
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
コード例 #18
0
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
コード例 #19
0
def daf_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(results(cl))}
コード例 #20
0
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))}
コード例 #21
0
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[0] == 1 and 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
コード例 #22
0
ファイル: hacks.py プロジェクト: stancel/paperless
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': list(results(cl))}
コード例 #23
0
ファイル: my_admin_list.py プロジェクト: skru/cartridge_app
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)),
    }
コード例 #24
0
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)),
    }
コード例 #25
0
def result_list(cl, user):  # added parameter 'user' to function
    """
    Display 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(results(cl, user))
    }
コード例 #26
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))}
            )
コード例 #27
0
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 result_tree(context, cl, request):

    headers = list(result_headers(cl))
    headers.insert(
        1 if needs_checkboxes(context) else 0, {
            'text': '+',
            'sortable': True,
            'url': request.path,
            'tooltip': _('Toggle expand/collapse all'),
            'class_attrib': mark_safe(' class="expand-all"')
        })
    return {
        'filtered': not check_empty_dict(request.GET),
        'result_hidden_fields': list(result_hidden_fields(cl)),
        'result_headers': headers,
        'results': list(results(cl)),
    }
コード例 #29
0
def result_list(cl, website):
    """
    Display the headers and data list together.
    """
    headers = list(result_headers(cl)) + list(custom_field_headers(website))
    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, website)),
    }
コード例 #30
0
def iresult_list(context, cl):
    """
    Displays the headers and data list together
    """
    tpl = select_template(cl.model_admin.get_template(context['request'], cl.model_admin.results_list_template))

#    request = context['request']
    headers = list(iresult_headers(cl))
    num_sorted_fields = 0
    for h in headers:
        if h['sortable'] and h['sorted']:
            num_sorted_fields += 1
    return tpl.render(Context({'cl': cl,
           'request': context['request'],
           'result_hidden_fields': list(result_hidden_fields(cl)),
            'result_headers': headers,
            'num_sorted_fields': num_sorted_fields,
            'results': list(iresults(cl, context))}))
コード例 #31
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))}
コード例 #32
0
def semantic_result_list(cl):
    """
    Display 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,
        "opts": cl.model_admin.opts,  # WTF?!
        "has_action_checkbox": has_action_checkbox(cl),
        "result_hidden_fields": list(result_hidden_fields(cl)),
        "result_headers": headers,
        "num_sorted_fields": num_sorted_fields,
        "results": list(semantic_results(cl)),
    }
コード例 #33
0
ファイル: djadmin.py プロジェクト: suryadana/djadmin
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))}
コード例 #34
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))}
コード例 #35
0
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,
    }
コード例 #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)),
    }
コード例 #37
0
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)
コード例 #38
0
ファイル: filter.py プロジェクト: kunkunkun1/myhome
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,}
コード例 #39
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)),
    }
コード例 #40
0
ファイル: admin_tree.py プロジェクト: PatriContreras/wagtail
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)),
    }
コード例 #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)),
    }
コード例 #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)),
    }
コード例 #43
0
ファイル: common_utils.py プロジェクト: serguitus/bookings
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))
    }
コード例 #44
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,
    }
コード例 #45
0
def iresult_list(context, cl):
    """
    Displays the headers and data list together
    """
    tpl = select_template(cl.model_admin.get_template(context["request"], cl.model_admin.results_list_template))

    #    request = context['request']
    headers = list(iresult_headers(cl))
    num_sorted_fields = 0
    for h in headers:
        if h["sortable"] and h["sorted"]:
            num_sorted_fields += 1
    return tpl.render(
        Context(
            {
                "cl": cl,
                "request": context["request"],
                "result_hidden_fields": list(result_hidden_fields(cl)),
                "result_headers": headers,
                "num_sorted_fields": num_sorted_fields,
                "results": list(iresults(cl, context)),
            }
        )
    )
コード例 #46
0
ファイル: admin.py プロジェクト: EVGENNN/KioCalendar
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)))}
コード例 #47
0
ファイル: paper_list.py プロジェクト: dldevinc/paper-admin
 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))