Changeset 1308
- Timestamp:
- 11/20/05 13:12:23 (3 years ago)
- Files:
-
- django/branches/new-admin/django/contrib/admin/templates/admin/change_list_results.html (modified) (1 diff)
- django/branches/new-admin/django/contrib/admin/templates/admin/pagination.html (modified) (1 diff)
- django/branches/new-admin/django/contrib/admin/templatetags/admin_list.py (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
django/branches/new-admin/django/contrib/admin/templates/admin/change_list_results.html
r1071 r1308 3 3 <tr> 4 4 {% for header in result_headers %}<th{{header.class_attrib}}> 5 {%if header.sortable%}<a href="{ % query_string cl override ORDER_VAR:i ORDER_TYPE_VAR:header.order %}" %>{%endif%}5 {%if header.sortable%}<a href="{{header.url}}" %>{%endif%} 6 6 {{header.text|capfirst}} 7 7 {%if header.sortable %}</a>{% endif %}</th>{% endfor %} django/branches/new-admin/django/contrib/admin/templates/admin/pagination.html
r1023 r1308 7 7 {%endif%} 8 8 {{cl.result_count}} {% ifequal cl.result_count 1 %}{{cl.opts.verbose_name}}{%else%}{{cl.opts.verbose_name_plural}}{%endifequal%} 9 {% if need_show_all_link %} <a href="{% query_string cl override ALL_VAR:'' %}" class="showall">Show all</a>{%endif%}9 {% if show_all_url %} <a href="{{show_all_url}}" class="showall">Show all</a>{%endif%} 10 10 11 11 </p> django/branches/new-admin/django/contrib/admin/templatetags/admin_list.py
r1282 r1308 15 15 from django.utils import dateformat 16 16 DOT = '.' 17 18 class QueryStringNode(template.Node):19 def __init__(self, cl_var, override_vars, remove_vars):20 self.cl_var, self.override_vars, self.remove_vars = cl_var, override_vars, remove_vars21 22 def render(self, context):23 def res(var):24 return template.resolve_variable(var, context)25 26 cl = res(self.cl_var)27 overrides = dict([ (res(k), res(v)) for k,v in self.override_vars ])28 remove = [res(v) for v in self.remove_vars]29 return cl.get_query_string(overrides, remove)30 31 def do_query_string(parser, token):32 bits = token.contents.split()[1:]33 in_override = False34 in_remove = False35 override_vars = []36 remove_vars = []37 cl_var = bits.pop(0)38 39 for word in bits:40 if in_override:41 if word == 'remove':42 in_remove = True43 in_override = False44 else:45 override_vars.append(word.split(':'))46 elif in_remove:47 remove_vars.append(word)48 else:49 if word == 'override':50 in_override = True51 elif word == 'remove':52 remove = True53 54 return QueryStringNode(cl_var, override_vars, remove_vars)55 56 template.register_tag('query_string', do_query_string)57 58 17 59 18 #@simple_tag … … 100 59 page_range.extend(range(page_num + 1, paginator.pages)) 101 60 61 need_show_all_link = cl.can_show_all and not cl.show_all and cl.multi_page 62 102 63 return {'cl': cl, 103 64 'pagination_required': pagination_required, 104 ' need_show_all_link': cl.can_show_all and not cl.show_all and cl.multi_page,65 'show_all_url': need_show_all_link and cl.get_query_string({ALL_VAR:''}), 105 66 'page_range': page_range, 106 67 'ALL_VAR': ALL_VAR, … … 142 103 yield {"text" : f.verbose_name, 143 104 "sortable": True, 144 " order" : new_order_type,105 "url" : cl.get_query_string({ORDER_VAR: i, ORDER_TYPE_VAR: new_order_type}), 145 106 "class_attrib" : (th_classes and ' class="%s"' % ' '.join(th_classes) or '') } 146 107
