Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #917 -- Made admin change_list view overridable by custom templ…

…ates

git-svn-id: http://code.djangoproject.com/svn/django/trunk@1468 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit 6a36699818e9c90edc0acfdb026522dcf913ba58 1 parent 4cdaf74
Adrian Holovaty authored November 27, 2005
10  django/contrib/admin/templates/admin/change_list.html
@@ -9,11 +9,11 @@
9 9
 <ul class="object-tools"><li><a href="add/{% if is_popup %}?_popup=1{% endif %}" class="addlink">{% blocktrans with cl.opts.verbose_name as name %}Add {{ name }}{% endblocktrans %}</a></li></ul>
10 10
 {% endif %}
11 11
 <div class="module{% if cl.has_filters %} filtered{% endif %}" id="changelist">
12  
-{% search_form cl %}
13  
-{% date_hierarchy cl %}
14  
-{% filters cl %}
15  
-{% result_list cl %}
16  
-{% pagination cl %}
  12
+{% block search %}{% search_form cl %}{% endblock %}
  13
+{% block date_hierarchy %}{% date_hierarchy cl %}{% endblock %}
  14
+{% block filters %}{% filters cl %}{% endblock %}
  15
+{% block result_list %}{% result_list cl %}{% endblock %}
  16
+{% block pagination %}{% pagination cl %}{% endblock %}
17 17
 </div>
18 18
 </div>
19 19
 {% endblock %}
9  django/contrib/admin/views/main.py
@@ -241,15 +241,14 @@ def change_list(request, app_label, module_name):
241 241
         'is_popup': cl.is_popup,
242 242
         'cl' : cl
243 243
     })
244  
-    c.update( { 'has_add_permission': c['perms'][app_label][cl.opts.get_add_permission()]}),
245  
-    return render_to_response('admin/change_list',
246  
-                               context_instance = c)
  244
+    c.update({'has_add_permission': c['perms'][app_label][cl.opts.get_add_permission()]}),
  245
+    return render_to_response(['admin/%s/%s/change_list' % (app_label, cl.opts.object_name.lower()),
  246
+                               'admin/%s/change_list' % app_label,
  247
+                               'admin/change_list'], context_instance=c)
247 248
 change_list = staff_member_required(change_list)
248 249
 
249  
-
250 250
 use_raw_id_admin = lambda field: isinstance(field.rel, (meta.ManyToOne, meta.ManyToMany)) and field.rel.raw_id_admin
251 251
 
252  
-
253 252
 def get_javascript_imports(opts,auto_populated_fields, ordered_objects, field_sets):
254 253
 # Put in any necessary JavaScript imports.
255 254
     js = ['js/core.js', 'js/admin/RelatedObjectLookups.js']

0 notes on commit 6a36699

Please sign in to comment.
Something went wrong with that request. Please try again.