Author: brosner Date: 2010-05-08 16:38:14 -0500 (Sat, 08 May 2010) New Revision: 13139
Modified: django/trunk/django/contrib/admin/templatetags/admin_list.py django/trunk/django/contrib/admin/templatetags/admin_modify.py Log: Fixed #1834 -- added docstrings to admin templatetags Thanks Rupe for work on a patch. Modified: django/trunk/django/contrib/admin/templatetags/admin_list.py =================================================================== --- django/trunk/django/contrib/admin/templatetags/admin_list.py 2010-05-08 21:38:00 UTC (rev 13138) +++ django/trunk/django/contrib/admin/templatetags/admin_list.py 2010-05-08 21:38:14 UTC (rev 13139) @@ -21,6 +21,9 @@ DOT = '.' def paginator_number(cl,i): + """ + Generates an individual page index link in a paginated list. + """ if i == DOT: return u'... ' elif i == cl.page_num: @@ -30,6 +33,9 @@ paginator_number = register.simple_tag(paginator_number) def pagination(cl): + """ + Generates the series of links to the pages in a paginated list. + """ paginator, page_num = cl.paginator, cl.page_num pagination_required = (not cl.show_all or not cl.can_show_all) and cl.multi_page @@ -73,6 +79,9 @@ pagination = register.inclusion_tag('admin/pagination.html')(pagination) def result_headers(cl): + """ + Generates the list column headers. + """ lookup_opts = cl.lookup_opts for i, field_name in enumerate(cl.list_display): @@ -118,6 +127,9 @@ return mark_safe(u'<img src="%simg/admin/icon-%s.gif" alt="%s" />' % (settings.ADMIN_MEDIA_PREFIX, BOOLEAN_MAPPING[field_val], field_val)) def items_for_result(cl, result, form): + """ + Generates the actual list of data. + """ first = True pk = cl.lookup_opts.pk.attname for field_name in cl.list_display: @@ -189,12 +201,18 @@ yield list(items_for_result(cl, res, None)) def result_list(cl): + """ + Displays the headers and data list together + """ return {'cl': cl, 'result_headers': list(result_headers(cl)), 'results': list(results(cl))} result_list = register.inclusion_tag("admin/change_list_results.html")(result_list) def date_hierarchy(cl): + """ + Displays the date hierarchy for date drill-down functionality. + """ if cl.date_hierarchy: field_name = cl.date_hierarchy year_field = '%s__year' % field_name @@ -255,6 +273,9 @@ date_hierarchy = register.inclusion_tag('admin/date_hierarchy.html')(date_hierarchy) def search_form(cl): + """ + Displays a search form for searching the list. + """ return { 'cl': cl, 'show_result_count': cl.result_count != cl.full_result_count, Modified: django/trunk/django/contrib/admin/templatetags/admin_modify.py =================================================================== --- django/trunk/django/contrib/admin/templatetags/admin_modify.py 2010-05-08 21:38:00 UTC (rev 13138) +++ django/trunk/django/contrib/admin/templatetags/admin_modify.py 2010-05-08 21:38:14 UTC (rev 13139) @@ -20,6 +20,9 @@ prepopulated_fields_js = register.inclusion_tag('admin/prepopulated_fields_js.html', takes_context=True)(prepopulated_fields_js) def submit_row(context): + """ + Displays the row of buttons for delete and save. + """ opts = context['opts'] change = context['change'] is_popup = context['is_popup'] -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-upda...@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-updates?hl=en.