From 16a7ccc95e89158d74dd94bd31a814431587aeef Mon Sep 17 00:00:00 2001 From: ibuler Date: Mon, 13 Mar 2023 18:06:54 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E4=BC=98=E5=8C=96=E6=96=87=E6=A1=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/common/drf/parsers/excel.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps/common/drf/parsers/excel.py b/apps/common/drf/parsers/excel.py index 59a28af32..111aa9526 100644 --- a/apps/common/drf/parsers/excel.py +++ b/apps/common/drf/parsers/excel.py @@ -1,4 +1,5 @@ import pyexcel +from django.utils.translation import gettext as _ from .base import BaseFileParser @@ -10,7 +11,7 @@ class ExcelFileParser(BaseFileParser): try: workbook = pyexcel.get_book(file_type='xlsx', file_content=stream_data) except Exception: - raise Exception('Invalid excel file') + raise Exception(_('Invalid excel file')) # 默认获取第一个工作表sheet sheet = workbook.sheet_by_index(0) rows = sheet.rows()