我認爲你需要重寫changelist_view
並從它返回的TemplateResponse()
作用或改變VA在那次電話會議之前拿着那個名字。
原有的功能是這樣的
def changelist_view(self, request, extra_context=None):
# a lot of stuff happen here
return TemplateResponse(request, self.change_list_template or [
'admin/%s/%s/change_list.html' % (app_label, opts.object_name.lower()),
'admin/%s/change_list.html' % app_label,
'admin/change_list.html'
], context, current_app=self.admin_site.name)
所以我認爲,這樣的代碼
def changelist(self, request, extra_context=None):
if request.GET['foo']:
self.change_list_template = "students/student_change_list_other.html"
return super(STUDENTAdmin, self).changelist_view(request, extra_context)
謝謝哥們,這是很好的 – user2330497 2013-05-14 09:46:48
歡迎您 – gipi 2013-05-14 10:45:26