Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby-on-rails-4/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
django管理员列表页面视图_Django_Django Admin - Fatal编程技术网

django管理员列表页面视图

django管理员列表页面视图,django,django-admin,Django,Django Admin,如何使用视图自定义django管理员列表页面,以及如何在template change_list.html中传递值以显示新字段,如中所示 我试图在管理中将列表视图写为: def get_urls(self): urls = super(BeneficiaryAdmin, self).get_urls() my_urls = patterns('', (r'^list_view/$', self.list_view) )

如何使用视图自定义django管理员列表页面,以及如何在template change_list.html中传递值以显示新字段,如中所示

我试图在管理中将列表视图写为:

def get_urls(self):
        urls = super(BeneficiaryAdmin, self).get_urls()
        my_urls = patterns('',
            (r'^list_view/$', self.list_view)
        )
        return my_urls + urls

def list_view(self, request):
        print "kkkkkkkkkkkkkkkkkkkkkkkkkk"
        # custom view which should return an HttpResponse
        return HttpResponseRedirect("/dashboard/member_management/beneficiary/")
但是列表视图不能调用。

你读过吗


我们可以使用此选项编辑列表视图页面。

我尝试了列表视图页面的“获取URL”和“我的视图”的编码。为了查看页面,我需要编写管理员视图。你能举一个例子吗?
def changelist_view(self, request, extra_context=None):
        from django.contrib.admin.views.main import ChangeList
        cl = ChangeList(request, self.model, list(self.list_display), 
                        self.list_display_links, self.list_filter, 
                        self.date_hierarchy, self.search_fields,  
                        self.list_select_related, 
                        self.list_per_page, 
                        self.list_editable, 
                        self)

        if extra_context is None: 
            extra_context = {}
return super(BeneficiaryAdmin, self).changelist_view(request, extra_context=extra_context)