This commit is contained in:
Jakub Kropáček 2025-03-03 21:56:04 +01:00
parent 1bd01f9652
commit b09e1b556b
7 changed files with 7 additions and 30 deletions

View file

@ -21,3 +21,4 @@ repos:
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format

View file

@ -1,11 +1,3 @@
"""
ASGI config for facturio project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/5.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application

View file

@ -1,14 +1,3 @@
"""
Django settings for facturio project.
Generated by 'django-admin startproject' using Django 5.0.
For more information on this file, see
https://docs.djangoproject.com/en/5.0/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/5.0/ref/settings/
"""
from pathlib import Path
from django.utils.translation import gettext_lazy as _

View file

@ -1,11 +1,3 @@
"""
WSGI config for facturio project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/5.0/howto/deployment/wsgi/
"""
import os
from django.core.wsgi import get_wsgi_application

View file

@ -90,7 +90,10 @@ class InvoiceFile(models.Model):
invoice = models.ForeignKey(Invoice, on_delete=models.CASCADE, related_name='files')
file = models.FileField(
_('File'), upload_to='invoice-files/%Y/%m/%d/', null=True, blank=True,
_('File'),
upload_to='invoice-files/%Y/%m/%d/',
null=True,
blank=True,
)
created_date = models.DateTimeField(_('Created Date'), auto_now=True)

View file

@ -18,5 +18,6 @@ def generate_pdf(invoice_id: int):
with client.chromium.url_to_pdf() as task:
res = task.url(print_url).run()
invoice_file.file.save(
invoice_file.get_file_name('pdf'), ContentFile(res.content),
invoice_file.get_file_name('pdf'),
ContentFile(res.content),
)

View file

@ -1,5 +1,4 @@
#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
import os
import sys