need advice on my first django site

Hi folks, this is my first post. Having eyed with web programming for quite some time now and being a fan of the python programming language, I finally jumped into the cold water and applied at my #dayjob for creating small internal web application. So far, what django has to offer seems like it’s love at first sight.

Since I am new in the django ecosystems, and with web programming in general I kindly ask for help to improve my application - more in the sense of architecture and best practices.

The application is used by several persons with the same access rights: they do upload a PDF report. This report is analyzed, and depending on the footer of each page several pages are written to a new file and is then mailed to a specific group of persons (one receipient as ist is a mailgroup). The users should just upload the PDF file, administer the receipients with a relation to a keyword in the footer of that file, and have an overview of the status of each generated and sent PDF file.

So in general, I have the models Receipient, Reportfile and Sendtask. Reportfile is the complete PDF file and sendtask is a model with a 2-5 page PDF file, a Receipient, a link to the complete PDF for reference and a statuscode.

Whenever a reportfile is uploaded, the models save() method checks whether it has been processed or not. If unprocessed, a task “dissect_pdf” using django-tasks is being enqueued. This task reads the PDF file, creates some smaller PDF files out of it and saves parts of the information from the main PDF file (like number of pages, number of subfiles) in the reportfile instance.

During that task “dissect_pdf” instances of sendtask are created with the smaller PDF files. The sendtask model also has a status field which is evaluated in its save() method. If it has the status “unprocessed”, save() enqueues a django-task “send_report_part” - this task then updates the status of the instance to “sent” or “failed”. “send_report_part” also increases the counters “number_of_failed_report_mails” and “number_of_successful_report_mails” of Reportfile.

As for views, I use ListView, DetailView and CreateView in very basic forms.

I hope I have managed to express myself clearly what this application does. However, since it is my first project with django I would be grateful to hear your opinions or suggestions on improving that thing.

Maybe someone has ideas for a more elegant solution to what I have tried to accomplish. Especially, I am not sure about whether going the route via the save() methods in combination with django-tasks was the right decision since basically the flow of execution is more or less (basically preventing recursive executing save() through using status codes), I would love some enlightenment:

Reportfile.save() → enques task (which also updates Reportfile) → create some Sendtask instances of which save() → enqueues task (which sends mails and updates Sendtask instance and the respective Reportfile instance)

I have also thought about grabbing the file from the request when a POST request is being performed on a CreateView. I also use a validator for the main PDF file: this opens the file with pypdf and performs some tests, which takes some time depending on filesize. At the moment the user has to wait until being presented the view is ok at the moment (~ 3 seconds). However, should the files grow dramatically I would need a better solution - any ideas?

Thanks for your opinions and ideas!