diff --git a/poetry.lock b/poetry.lock index 2189bd52..a176493a 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1422,19 +1422,19 @@ dev = ["black"] [[package]] name = "django-weasyprint" -version = "2.4.0" +version = "2.5.0" description = "Django WeasyPrint integration" optional = false -python-versions = ">=3.8" +python-versions = ">=3.10" groups = ["main"] files = [ - {file = "django_weasyprint-2.4.0-py3-none-any.whl", hash = "sha256:06bc90bcc84f33d6675815498616cc82153ea924227d336bf32e5bf54da117d1"}, - {file = "django_weasyprint-2.4.0.tar.gz", hash = "sha256:9a1d7c687a6c4678f3ac97e48b0ede495b47e17218e8ee6bea454bc8cfa6b60f"}, + {file = "django_weasyprint-2.5.0-py3-none-any.whl", hash = "sha256:1607ef0c8223d7b15e7d4a501a3ec92fb6065179e667135aa50581b7d21aefa3"}, + {file = "django_weasyprint-2.5.0.tar.gz", hash = "sha256:362956b650d2a053967471c0ce15857f08e30253a3eeb746aef7c459d3ee9cf9"}, ] [package.dependencies] Django = ">=3.2" -WeasyPrint = ">=59" +WeasyPrint = ">=68" [[package]] name = "djangorestframework" @@ -4227,4 +4227,4 @@ test = ["pytest"] [metadata] lock-version = "2.1" python-versions = ">=3.13,<4.0" -content-hash = "5dfccddc8366d0e2b4bd921394eae630571fd3a471c3c2c763f74f2746cd468b" +content-hash = "06e8a4542b91fefe52a650321ee410d3641a4512819ef794dfea684fc1580f73" diff --git a/pyproject.toml b/pyproject.toml index 08f75f03..4afbcdfd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ readme = "README.md" requires-python = ">=3.13,<4.0" dependencies = [ "django (>=5.2.12,<6.0)", - "django-weasyprint (>=2.4.0,<3.0.0)", + "django-weasyprint (>=2.5.0,<3.0.0)", "django-extensions (>=4.1,<5.0)", "django-bootstrap-datepicker-plus (>=5.0.6,<6.0.0)", "psycopg2 (>=2.9.11,<3.0.0)", @@ -20,7 +20,7 @@ dependencies = [ "tablib (>=3.9.0,<4.0.0)", "django-phonenumber-field (>=8.3.0,<9.0.0)", "phonenumbers (>=9.0.26,<10.0.0)", - "weasyprint (>=68.1,<69.0)", # Update when https://github.com/fdemmer/django-weasyprint/issues/106 is resolved + "weasyprint (>=68.1,<69.0)", "django-select2 (>=8.4.3,<9.0.0)", "gunicorn (>=25.1.0,<26.0.0)", "django-environ (>=0.13.0,<0.14.0)", diff --git a/tapir/utils/pdfs.py b/tapir/utils/pdfs.py index 37f5d013..7d71c040 100644 --- a/tapir/utils/pdfs.py +++ b/tapir/utils/pdfs.py @@ -4,7 +4,7 @@ from django.conf import settings from django.template.loader import render_to_string from django.utils import translation -from django_weasyprint.utils import django_url_fetcher +from django_weasyprint.utils import DjangoURLFetcher from weasyprint import Document from weasyprint.text.fonts import FontConfiguration @@ -20,6 +20,6 @@ def render_pdf(templates: List, context: dict, language: str) -> Document: document = weasyprint.HTML( string=rendered_html, base_url=settings.WEASYPRINT_BASEURL, - url_fetcher=django_url_fetcher, + url_fetcher=DjangoURLFetcher(), ) return document.render(font_config=_WEASYPRINT_FONT_CONFIG)