2022-08-27 07:38:54 +03:00
|
|
|
import asyncio
|
2022-08-26 23:18:02 +03:00
|
|
|
|
|
|
|
import docx2txt
|
2022-08-26 20:04:45 +03:00
|
|
|
from django.db.models.signals import post_save
|
|
|
|
from django.dispatch import receiver
|
|
|
|
|
2022-08-27 07:38:54 +03:00
|
|
|
from checker.models import Docx, Paragraph
|
2022-08-26 23:18:02 +03:00
|
|
|
from checker.services.file import process_paragraphs
|
2022-08-27 07:38:54 +03:00
|
|
|
from checker.tasks import process_file
|
|
|
|
import threading
|
|
|
|
import asyncio
|
2022-08-26 20:04:45 +03:00
|
|
|
|
|
|
|
|
|
|
|
@receiver(post_save, sender=Docx)
|
2022-08-26 23:18:02 +03:00
|
|
|
def create_docs(sender, instance, created, **kwargs):
|
2022-08-26 20:04:45 +03:00
|
|
|
if created:
|
2022-08-27 07:38:54 +03:00
|
|
|
process_file.apply_async((instance.pk))
|
2022-08-26 20:04:45 +03:00
|
|
|
return
|