Update admin.py

This commit is contained in:
myleosu 2019-11-16 21:56:03 +08:00 committed by GitHub
parent 43df53adaf
commit 02a32f1c02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -676,8 +676,8 @@ class FPSProblemImport(CSRFExemptAPIView):
with tempfile.NamedTemporaryFile("wb") as tf:
for chunk in file.chunks(4096):
tf.file.write(chunk)
tf.file.flush() #确保file写入tf成功
os.fsync(tf.file) #确保file写入tf成功
tf.file.flush()
os.fsync(tf.file)
problems = FPSParser(tf.name).parse()
else:
return self.error("Parse upload file error")