Ticket #1834: 1834-1.1.X.diff

File 1834-1.1.X.diff, 2.8 KB (added by Ramiro Morales, 15 years ago)

Rupe's patch ported to 1.1.X branch

  • django/contrib/admin/templatetags/admin_list.py

    diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py
    a b  
    1717DOT = '.'
    1818
    1919def paginator_number(cl,i):
     20    """
     21    Generates an individual page index link in a paginated list.
     22    """
    2023    if i == DOT:
    2124        return u'... '
    2225    elif i == cl.page_num:
     
    2629paginator_number = register.simple_tag(paginator_number)
    2730
    2831def pagination(cl):
     32    """
     33    Generates the series of links to the pages in a paginated list.
     34    """
    2935    paginator, page_num = cl.paginator, cl.page_num
    3036
    3137    pagination_required = (not cl.show_all or not cl.can_show_all) and cl.multi_page
     
    6975pagination = register.inclusion_tag('admin/pagination.html')(pagination)
    7076
    7177def result_headers(cl):
     78    """
     79    Generates the list column headers.
     80    """
    7281    lookup_opts = cl.lookup_opts
    7382
    7483    for i, field_name in enumerate(cl.list_display):
     
    139148    return mark_safe(u'<img src="%simg/admin/icon-%s.gif" alt="%s" />' % (settings.ADMIN_MEDIA_PREFIX, BOOLEAN_MAPPING[field_val], field_val))
    140149
    141150def items_for_result(cl, result, form):
     151    """
     152    Generates the actual list of data.
     153    """
    142154    first = True
    143155    pk = cl.lookup_opts.pk.attname
    144156    for field_name in cl.list_display:
     
    253265            yield list(items_for_result(cl, res, None))
    254266
    255267def result_list(cl):
     268    """
     269    Displays the headers and data list together
     270    """
    256271    return {'cl': cl,
    257272            'result_headers': list(result_headers(cl)),
    258273            'results': list(results(cl))}
    259274result_list = register.inclusion_tag("admin/change_list_results.html")(result_list)
    260275
    261276def date_hierarchy(cl):
     277    """
     278    Displays the date hierarchy for date drill-down functionality.
     279    """
    262280    if cl.date_hierarchy:
    263281        field_name = cl.date_hierarchy
    264282        year_field = '%s__year' % field_name
     
    320338date_hierarchy = register.inclusion_tag('admin/date_hierarchy.html')(date_hierarchy)
    321339
    322340def search_form(cl):
     341    """
     342    Displays a search form for searching the list.
     343    """
    323344    return {
    324345        'cl': cl,
    325346        'show_result_count': cl.result_count != cl.full_result_count,
  • django/contrib/admin/templatetags/admin_modify.py

    diff --git a/django/contrib/admin/templatetags/admin_modify.py b/django/contrib/admin/templatetags/admin_modify.py
    a b  
    2020prepopulated_fields_js = register.inclusion_tag('admin/prepopulated_fields_js.html', takes_context=True)(prepopulated_fields_js)
    2121
    2222def submit_row(context):
     23    """
     24    Displays the row of buttons for delete and save.
     25    """
    2326    opts = context['opts']
    2427    change = context['change']
    2528    is_popup = context['is_popup']
Back to Top