Ticket #1834: admin_templatetags_docstrings.diff

File admin_templatetags_docstrings.diff, 2.9 KB (added by Joshua Russo, 14 years ago)

docstrings for admin templatetags and some internal functions

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

     
    2121DOT = '.'
    2222
    2323def paginator_number(cl,i):
     24    """
     25    Generates an individual page index link in a paginated list.
     26    """
    2427    if i == DOT:
    2528        return u'... '
    2629    elif i == cl.page_num:
     
    3033paginator_number = register.simple_tag(paginator_number)
    3134
    3235def pagination(cl):
     36    """
     37    Generates the series of links to the pages in a paginated list.
     38    """
    3339    paginator, page_num = cl.paginator, cl.page_num
    3440
    3541    pagination_required = (not cl.show_all or not cl.can_show_all) and cl.multi_page
     
    7379pagination = register.inclusion_tag('admin/pagination.html')(pagination)
    7480
    7581def result_headers(cl):
     82    """
     83    Generates the list column headers.
     84    """
    7685    lookup_opts = cl.lookup_opts
    7786
    7887    for i, field_name in enumerate(cl.list_display):
     
    118127    return mark_safe(u'<img src="%simg/admin/icon-%s.gif" alt="%s" />' % (settings.ADMIN_MEDIA_PREFIX, BOOLEAN_MAPPING[field_val], field_val))
    119128
    120129def items_for_result(cl, result, form):
     130    """
     131    Generates the actual list of data.
     132    """
    121133    first = True
    122134    pk = cl.lookup_opts.pk.attname
    123135    for field_name in cl.list_display:
     
    189201            yield list(items_for_result(cl, res, None))
    190202
    191203def result_list(cl):
     204    """
     205    Displays the headers and data list together
     206    """
    192207    return {'cl': cl,
    193208            'result_headers': list(result_headers(cl)),
    194209            'results': list(results(cl))}
    195210result_list = register.inclusion_tag("admin/change_list_results.html")(result_list)
    196211
    197212def date_hierarchy(cl):
     213    """
     214    Displays the date hierarchy for date drill-down functionality.
     215    """
    198216    if cl.date_hierarchy:
    199217        field_name = cl.date_hierarchy
    200218        year_field = '%s__year' % field_name
     
    255273date_hierarchy = register.inclusion_tag('admin/date_hierarchy.html')(date_hierarchy)
    256274
    257275def search_form(cl):
     276    """
     277    Displays a search form for searching the list.
     278    """
    258279    return {
    259280        'cl': cl,
    260281        'show_result_count': cl.result_count != cl.full_result_count,
  • django/contrib/admin/templatetags/admin_modify.py

     
    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