Django中的changelist_view

时间:2011-10-28 11:16:24

标签: django django-views

如何从my_app.views调用changelist_view?我需要将渲染HTML保存到文件/ db

def view_to_string(self, request, extra_context=None):
        from django.template.loader import render_to_string
        from django.http import HttpResponse
        import codecs
        file = super(ProjectAdmin, self).changelist_view(request, extra_context=Non
        f = codecs.open('/home/django/workfile', 'w', encoding="UTF-8")
        f.write(str(file).decode("utf8"))
        f.close()

0 个答案:

没有答案