Skip to content

Commit c14bd21

Browse files
committed
实现了可视化图表设计结果的保存格式化和存储位置的形成
Signed-off-by: Sadam·Sadik <1903249375@qq.com>
1 parent 41dfc11 commit c14bd21

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "DjangoAsyncAdmin"
3-
version = "6.9.0"
3+
version = "6.10.0"
44
authors = [
55
{ name = "Sadam·Sadik", email = "1903249375@qq.com" },
66
]

simplepro/bawa/views.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
from django.utils.translation import ugettext as _
99
except:
1010
from django.utils.translation import gettext as _
11-
12-
save_dir = os.path.join(os.getcwd(), 'bawa')
11+
from django.conf import settings
12+
save_dir = os.path.join(settings.BASE_DIR, 'bawa')
1313
save_file = os.path.join(save_dir, 'bawa_data.json')
1414

1515

@@ -30,8 +30,9 @@ def save(request):
3030
os.mkdir(save_dir)
3131

3232
r = request.POST.get('data')
33-
with open(save_file, 'wb') as f:
34-
f.write(bytes(r, 'utf-8'))
33+
bawa_data = json.loads(r)
34+
with open(save_file, 'w') as f:
35+
json.dump(bawa_data, f, ensure_ascii=False, indent=4)
3536
except Exception as e:
3637
rs = {
3738
'msg': _('Server error') + e,

0 commit comments

Comments
 (0)