form_data = TextIOWrapper(
request.FILES["file"].file, encoding="utf-8")
if project.is_type_of(Project.SEQUENCE_LABELING):
Document.objects.bulk_create([
Document(text=line.strip(), project=project)
for line in form_data
])
else:
reader = csv.reader(form_data)
Document.objects.bulk_create([
After Change
except Exception as e:
logger.exception(e)
messages.add_message(request, messages.ERROR, "Something went wrong")
return HttpResponseRedirect(reverse("upload", args=[project.id]))
class DataDownload(SuperUserMixin, LoginRequiredMixin, TemplateView):