views.py 文件源码

python
阅读 19 收藏 0 点赞 0 评论 0

项目:django-experience 作者: rg3915 项目源码 文件源码
def export_data(request, atype):
    if atype == "sheet":
        return excel.make_response_from_a_table(
            Customer, 'xls', file_name="sheet")
    elif atype == "custom":
        query_sets = Customer.objects.all()
        column_names = ['first_name', 'last_name', 'email', 'birthday']
        return excel.make_response_from_query_sets(
            query_sets,
            column_names,
            'xls',
            file_name="custom"
        )
    else:
        return HttpResponseBadRequest(
            "Bad request. please put one of these " +
            "in your url suffix: sheet, book or custom")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号