Ticket #1834: admin_templatetags_docstrings.diff
File admin_templatetags_docstrings.diff, 2.9 KB (added by , 15 years ago) |
---|
-
django/contrib/admin/templatetags/admin_list.py
21 21 DOT = '.' 22 22 23 23 def paginator_number(cl,i): 24 """ 25 Generates an individual page index link in a paginated list. 26 """ 24 27 if i == DOT: 25 28 return u'... ' 26 29 elif i == cl.page_num: … … 30 33 paginator_number = register.simple_tag(paginator_number) 31 34 32 35 def pagination(cl): 36 """ 37 Generates the series of links to the pages in a paginated list. 38 """ 33 39 paginator, page_num = cl.paginator, cl.page_num 34 40 35 41 pagination_required = (not cl.show_all or not cl.can_show_all) and cl.multi_page … … 73 79 pagination = register.inclusion_tag('admin/pagination.html')(pagination) 74 80 75 81 def result_headers(cl): 82 """ 83 Generates the list column headers. 84 """ 76 85 lookup_opts = cl.lookup_opts 77 86 78 87 for i, field_name in enumerate(cl.list_display): … … 118 127 return mark_safe(u'<img src="%simg/admin/icon-%s.gif" alt="%s" />' % (settings.ADMIN_MEDIA_PREFIX, BOOLEAN_MAPPING[field_val], field_val)) 119 128 120 129 def items_for_result(cl, result, form): 130 """ 131 Generates the actual list of data. 132 """ 121 133 first = True 122 134 pk = cl.lookup_opts.pk.attname 123 135 for field_name in cl.list_display: … … 189 201 yield list(items_for_result(cl, res, None)) 190 202 191 203 def result_list(cl): 204 """ 205 Displays the headers and data list together 206 """ 192 207 return {'cl': cl, 193 208 'result_headers': list(result_headers(cl)), 194 209 'results': list(results(cl))} 195 210 result_list = register.inclusion_tag("admin/change_list_results.html")(result_list) 196 211 197 212 def date_hierarchy(cl): 213 """ 214 Displays the date hierarchy for date drill-down functionality. 215 """ 198 216 if cl.date_hierarchy: 199 217 field_name = cl.date_hierarchy 200 218 year_field = '%s__year' % field_name … … 255 273 date_hierarchy = register.inclusion_tag('admin/date_hierarchy.html')(date_hierarchy) 256 274 257 275 def search_form(cl): 276 """ 277 Displays a search form for searching the list. 278 """ 258 279 return { 259 280 'cl': cl, 260 281 'show_result_count': cl.result_count != cl.full_result_count, -
django/contrib/admin/templatetags/admin_modify.py
20 20 prepopulated_fields_js = register.inclusion_tag('admin/prepopulated_fields_js.html', takes_context=True)(prepopulated_fields_js) 21 21 22 22 def submit_row(context): 23 """ 24 Displays the row of buttons for delete and save. 25 """ 23 26 opts = context['opts'] 24 27 change = context['change'] 25 28 is_popup = context['is_popup']