add pdf label

This commit is contained in:
Tomáš Mládek 2020-04-01 00:13:57 +02:00
parent d1c17c3c73
commit 80889a9a58
7 changed files with 531 additions and 7 deletions

258
poetry.lock generated
View file

@ -26,6 +26,53 @@ optional = false
python-versions = "*" python-versions = "*"
version = "0.1.0" version = "0.1.0"
[[package]]
category = "main"
description = "cffi-based cairo bindings for Python"
name = "cairocffi"
optional = false
python-versions = ">= 3.5"
version = "1.1.0"
[package.dependencies]
cffi = ">=1.1.0"
setuptools = ">=39.2.0"
[package.extras]
doc = ["sphinx", "sphinx-rtd-theme"]
test = ["pytest-runner", "pytest-cov", "pytest-flake8", "pytest-isort"]
xcb = ["xcffib (>=0.3.2)"]
[[package]]
category = "main"
description = "A Simple SVG Converter based on Cairo"
name = "cairosvg"
optional = false
python-versions = ">= 3.5"
version = "2.4.2"
[package.dependencies]
cairocffi = "*"
cssselect2 = "*"
defusedxml = "*"
pillow = "*"
tinycss2 = "*"
[package.extras]
doc = ["sphinx", "sphinx-rtd-theme"]
test = ["pytest-runner", "pytest-cov", "pytest-flake8", "pytest-isort"]
[[package]]
category = "main"
description = "Foreign Function Interface for Python calling C code."
name = "cffi"
optional = false
python-versions = "*"
version = "1.14.0"
[package.dependencies]
pycparser = "*"
[[package]] [[package]]
category = "dev" category = "dev"
description = "Cross-platform colored terminal text." description = "Cross-platform colored terminal text."
@ -35,6 +82,23 @@ optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*" python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
version = "0.4.3" version = "0.4.3"
[[package]]
category = "main"
description = "CSS selectors for Python ElementTree"
name = "cssselect2"
optional = false
python-versions = ">=3.5"
version = "0.3.0"
[package.dependencies]
setuptools = ">=39.2.0"
tinycss2 = "*"
webencodings = "*"
[package.extras]
doc = ["sphinx", "sphinx-rtd-theme"]
test = ["pytest-runner", "pytest-cov", "pytest-flake8", "pytest-isort"]
[[package]] [[package]]
category = "dev" category = "dev"
description = "Decorators for Humans" description = "Decorators for Humans"
@ -43,6 +107,14 @@ optional = false
python-versions = ">=2.6, !=3.0.*, !=3.1.*" python-versions = ">=2.6, !=3.0.*, !=3.1.*"
version = "4.4.2" version = "4.4.2"
[[package]]
category = "main"
description = "XML bomb protection for Python stdlib modules"
name = "defusedxml"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*"
version = "0.6.0"
[[package]] [[package]]
category = "main" category = "main"
description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design." description = "A high-level Python Web framework that encourages rapid development and clean, pragmatic design."
@ -88,6 +160,25 @@ gevent = ["gevent (>=0.13)"]
setproctitle = ["setproctitle"] setproctitle = ["setproctitle"]
tornado = ["tornado (>=0.2)"] tornado = ["tornado (>=0.2)"]
[[package]]
category = "main"
description = "HTML parser based on the WHATWG HTML specification"
name = "html5lib"
optional = false
python-versions = "*"
version = "1.0.1"
[package.dependencies]
six = ">=1.9"
webencodings = "*"
[package.extras]
all = ["genshi", "chardet (>=2.2)", "datrie", "lxml"]
chardet = ["chardet (>=2.2)"]
datrie = ["datrie"]
genshi = ["genshi"]
lxml = ["lxml"]
[[package]] [[package]]
category = "dev" category = "dev"
description = "IPython: Productive Interactive Computing" description = "IPython: Productive Interactive Computing"
@ -174,6 +265,14 @@ optional = false
python-versions = "*" python-versions = "*"
version = "0.7.5" version = "0.7.5"
[[package]]
category = "main"
description = "Python Imaging Library (Fork)"
name = "pillow"
optional = false
python-versions = ">=3.5"
version = "7.0.0"
[[package]] [[package]]
category = "dev" category = "dev"
description = "Library for building powerful interactive command lines in Python" description = "Library for building powerful interactive command lines in Python"
@ -194,6 +293,14 @@ optional = false
python-versions = "*" python-versions = "*"
version = "0.6.0" version = "0.6.0"
[[package]]
category = "main"
description = "C parser in Python"
name = "pycparser"
optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "2.20"
[[package]] [[package]]
category = "dev" category = "dev"
description = "Pygments is a syntax highlighting package written in Python." description = "Pygments is a syntax highlighting package written in Python."
@ -202,6 +309,14 @@ optional = false
python-versions = ">=3.5" python-versions = ">=3.5"
version = "2.6.1" version = "2.6.1"
[[package]]
category = "main"
description = "Pure Python module to hyphenate text"
name = "pyphen"
optional = false
python-versions = "*"
version = "0.9.5"
[[package]] [[package]]
category = "main" category = "main"
description = "World timezone definitions, modern and historical" description = "World timezone definitions, modern and historical"
@ -211,7 +326,7 @@ python-versions = "*"
version = "2019.3" version = "2019.3"
[[package]] [[package]]
category = "dev" category = "main"
description = "Python 2 and 3 compatibility utilities" description = "Python 2 and 3 compatibility utilities"
name = "six" name = "six"
optional = false optional = false
@ -226,6 +341,22 @@ optional = false
python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*" python-versions = ">=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*"
version = "0.3.1" version = "0.3.1"
[[package]]
category = "main"
description = "Low-level CSS parser for Python"
name = "tinycss2"
optional = false
python-versions = ">= 3.5"
version = "1.0.2"
[package.dependencies]
setuptools = ">=39.2.0"
webencodings = ">=0.4"
[package.extras]
doc = ["sphinx", "sphinx-rtd-theme"]
test = ["pytest-runner", "pytest-cov", "pytest-flake8", "pytest-isort"]
[[package]] [[package]]
category = "dev" category = "dev"
description = "Traitlets Python config system" description = "Traitlets Python config system"
@ -250,8 +381,38 @@ optional = false
python-versions = "*" python-versions = "*"
version = "0.1.8" version = "0.1.8"
[[package]]
category = "main"
description = "The Awesome Document Factory"
name = "weasyprint"
optional = false
python-versions = ">=3.5"
version = "51"
[package.dependencies]
CairoSVG = ">=2.4.0"
Pyphen = ">=0.9.1"
cairocffi = ">=0.9.0"
cffi = ">=0.6"
cssselect2 = ">=0.1"
html5lib = ">=0.999999999"
setuptools = ">=39.2.0"
tinycss2 = ">=1.0.0"
[package.extras]
doc = ["sphinx", "sphinx-rtd-theme"]
test = ["pytest-runner", "pytest-cov", "pytest-flake8", "pytest-isort"]
[[package]]
category = "main"
description = "Character encoding aliases for legacy web content"
name = "webencodings"
optional = false
python-versions = "*"
version = "0.5.1"
[metadata] [metadata]
content-hash = "97f08d0fc2077aa9a96d914e261bed55975e63bddb6b3433331375fac6080d2a" content-hash = "f551392acf27b79f04c5fab68df548257f3a538875f9b4bf501e4633a3761860"
python-versions = "^3.8" python-versions = "^3.8"
[metadata.files] [metadata.files]
@ -267,14 +428,59 @@ backcall = [
{file = "backcall-0.1.0.tar.gz", hash = "sha256:38ecd85be2c1e78f77fd91700c76e14667dc21e2713b63876c0eb901196e01e4"}, {file = "backcall-0.1.0.tar.gz", hash = "sha256:38ecd85be2c1e78f77fd91700c76e14667dc21e2713b63876c0eb901196e01e4"},
{file = "backcall-0.1.0.zip", hash = "sha256:bbbf4b1e5cd2bdb08f915895b51081c041bac22394fdfcfdfbe9f14b77c08bf2"}, {file = "backcall-0.1.0.zip", hash = "sha256:bbbf4b1e5cd2bdb08f915895b51081c041bac22394fdfcfdfbe9f14b77c08bf2"},
] ]
cairocffi = [
{file = "cairocffi-1.1.0.tar.gz", hash = "sha256:f1c0c5878f74ac9ccb5d48b2601fcc75390c881ce476e79f4cfedd288b1b05db"},
]
cairosvg = [
{file = "CairoSVG-2.4.2-py3-none-any.whl", hash = "sha256:9cb1df7e9bc60f75fb87f67940a8fb805aad544337a67a40b67c05cfe33711a2"},
{file = "CairoSVG-2.4.2.tar.gz", hash = "sha256:4e668f96653326780036ebb0a9ff2bb59a8443d7bcfc51a14aab77b57a8e67ad"},
]
cffi = [
{file = "cffi-1.14.0-cp27-cp27m-macosx_10_9_x86_64.whl", hash = "sha256:1cae98a7054b5c9391eb3249b86e0e99ab1e02bb0cc0575da191aedadbdf4384"},
{file = "cffi-1.14.0-cp27-cp27m-manylinux1_i686.whl", hash = "sha256:cf16e3cf6c0a5fdd9bc10c21687e19d29ad1fe863372b5543deaec1039581a30"},
{file = "cffi-1.14.0-cp27-cp27m-manylinux1_x86_64.whl", hash = "sha256:f2b0fa0c01d8a0c7483afd9f31d7ecf2d71760ca24499c8697aeb5ca37dc090c"},
{file = "cffi-1.14.0-cp27-cp27m-win32.whl", hash = "sha256:99f748a7e71ff382613b4e1acc0ac83bf7ad167fb3802e35e90d9763daba4d78"},
{file = "cffi-1.14.0-cp27-cp27m-win_amd64.whl", hash = "sha256:c420917b188a5582a56d8b93bdd8e0f6eca08c84ff623a4c16e809152cd35793"},
{file = "cffi-1.14.0-cp27-cp27mu-manylinux1_i686.whl", hash = "sha256:399aed636c7d3749bbed55bc907c3288cb43c65c4389964ad5ff849b6370603e"},
{file = "cffi-1.14.0-cp27-cp27mu-manylinux1_x86_64.whl", hash = "sha256:cab50b8c2250b46fe738c77dbd25ce017d5e6fb35d3407606e7a4180656a5a6a"},
{file = "cffi-1.14.0-cp35-cp35m-macosx_10_9_x86_64.whl", hash = "sha256:001bf3242a1bb04d985d63e138230802c6c8d4db3668fb545fb5005ddf5bb5ff"},
{file = "cffi-1.14.0-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:e56c744aa6ff427a607763346e4170629caf7e48ead6921745986db3692f987f"},
{file = "cffi-1.14.0-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:b8c78301cefcf5fd914aad35d3c04c2b21ce8629b5e4f4e45ae6812e461910fa"},
{file = "cffi-1.14.0-cp35-cp35m-win32.whl", hash = "sha256:8c0ffc886aea5df6a1762d0019e9cb05f825d0eec1f520c51be9d198701daee5"},
{file = "cffi-1.14.0-cp35-cp35m-win_amd64.whl", hash = "sha256:8a6c688fefb4e1cd56feb6c511984a6c4f7ec7d2a1ff31a10254f3c817054ae4"},
{file = "cffi-1.14.0-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:95cd16d3dee553f882540c1ffe331d085c9e629499ceadfbda4d4fde635f4b7d"},
{file = "cffi-1.14.0-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:66e41db66b47d0d8672d8ed2708ba91b2f2524ece3dee48b5dfb36be8c2f21dc"},
{file = "cffi-1.14.0-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:028a579fc9aed3af38f4892bdcc7390508adabc30c6af4a6e4f611b0c680e6ac"},
{file = "cffi-1.14.0-cp36-cp36m-win32.whl", hash = "sha256:cef128cb4d5e0b3493f058f10ce32365972c554572ff821e175dbc6f8ff6924f"},
{file = "cffi-1.14.0-cp36-cp36m-win_amd64.whl", hash = "sha256:337d448e5a725bba2d8293c48d9353fc68d0e9e4088d62a9571def317797522b"},
{file = "cffi-1.14.0-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:e577934fc5f8779c554639376beeaa5657d54349096ef24abe8c74c5d9c117c3"},
{file = "cffi-1.14.0-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:62ae9af2d069ea2698bf536dcfe1e4eed9090211dbaafeeedf5cb6c41b352f66"},
{file = "cffi-1.14.0-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:14491a910663bf9f13ddf2bc8f60562d6bc5315c1f09c704937ef17293fb85b0"},
{file = "cffi-1.14.0-cp37-cp37m-win32.whl", hash = "sha256:c43866529f2f06fe0edc6246eb4faa34f03fe88b64a0a9a942561c8e22f4b71f"},
{file = "cffi-1.14.0-cp37-cp37m-win_amd64.whl", hash = "sha256:2089ed025da3919d2e75a4d963d008330c96751127dd6f73c8dc0c65041b4c26"},
{file = "cffi-1.14.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:3b911c2dbd4f423b4c4fcca138cadde747abdb20d196c4a48708b8a2d32b16dd"},
{file = "cffi-1.14.0-cp38-cp38-manylinux1_i686.whl", hash = "sha256:7e63cbcf2429a8dbfe48dcc2322d5f2220b77b2e17b7ba023d6166d84655da55"},
{file = "cffi-1.14.0-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:3d311bcc4a41408cf5854f06ef2c5cab88f9fded37a3b95936c9879c1640d4c2"},
{file = "cffi-1.14.0-cp38-cp38-win32.whl", hash = "sha256:675686925a9fb403edba0114db74e741d8181683dcf216be697d208857e04ca8"},
{file = "cffi-1.14.0-cp38-cp38-win_amd64.whl", hash = "sha256:00789914be39dffba161cfc5be31b55775de5ba2235fe49aa28c148236c4e06b"},
{file = "cffi-1.14.0.tar.gz", hash = "sha256:2d384f4a127a15ba701207f7639d94106693b6cd64173d6c8988e2c25f3ac2b6"},
]
colorama = [ colorama = [
{file = "colorama-0.4.3-py2.py3-none-any.whl", hash = "sha256:7d73d2a99753107a36ac6b455ee49046802e59d9d076ef8e47b61499fa29afff"}, {file = "colorama-0.4.3-py2.py3-none-any.whl", hash = "sha256:7d73d2a99753107a36ac6b455ee49046802e59d9d076ef8e47b61499fa29afff"},
{file = "colorama-0.4.3.tar.gz", hash = "sha256:e96da0d330793e2cb9485e9ddfd918d456036c7149416295932478192f4436a1"}, {file = "colorama-0.4.3.tar.gz", hash = "sha256:e96da0d330793e2cb9485e9ddfd918d456036c7149416295932478192f4436a1"},
] ]
cssselect2 = [
{file = "cssselect2-0.3.0-py3-none-any.whl", hash = "sha256:97d7d4234f846f9996d838964d38e13b45541c18143bc55cf00e4bc1281ace76"},
{file = "cssselect2-0.3.0.tar.gz", hash = "sha256:5c2716f06b5de93f701d5755a9666f2ee22cbcd8b4da8adddfc30095ffea3abc"},
]
decorator = [ decorator = [
{file = "decorator-4.4.2-py2.py3-none-any.whl", hash = "sha256:41fa54c2a0cc4ba648be4fd43cff00aedf5b9465c9bf18d64325bc225f08f760"}, {file = "decorator-4.4.2-py2.py3-none-any.whl", hash = "sha256:41fa54c2a0cc4ba648be4fd43cff00aedf5b9465c9bf18d64325bc225f08f760"},
{file = "decorator-4.4.2.tar.gz", hash = "sha256:e3a62f0520172440ca0dcc823749319382e377f37f140a0b99ef45fecb84bfe7"}, {file = "decorator-4.4.2.tar.gz", hash = "sha256:e3a62f0520172440ca0dcc823749319382e377f37f140a0b99ef45fecb84bfe7"},
] ]
defusedxml = [
{file = "defusedxml-0.6.0-py2.py3-none-any.whl", hash = "sha256:6687150770438374ab581bb7a1b327a847dd9c5749e396102de3fad4e8a3ef93"},
{file = "defusedxml-0.6.0.tar.gz", hash = "sha256:f684034d135af4c6cbb949b8a4d2ed61634515257a67299e5f940fbaa34377f5"},
]
django = [ django = [
{file = "Django-3.0.4-py3-none-any.whl", hash = "sha256:89e451bfbb815280b137e33e454ddd56481fdaa6334054e6e031041ee1eda360"}, {file = "Django-3.0.4-py3-none-any.whl", hash = "sha256:89e451bfbb815280b137e33e454ddd56481fdaa6334054e6e031041ee1eda360"},
{file = "Django-3.0.4.tar.gz", hash = "sha256:50b781f6cbeb98f673aa76ed8e572a019a45e52bdd4ad09001072dfd91ab07c8"}, {file = "Django-3.0.4.tar.gz", hash = "sha256:50b781f6cbeb98f673aa76ed8e572a019a45e52bdd4ad09001072dfd91ab07c8"},
@ -287,6 +493,10 @@ gunicorn = [
{file = "gunicorn-20.0.4-py2.py3-none-any.whl", hash = "sha256:cd4a810dd51bf497552cf3f863b575dabd73d6ad6a91075b65936b151cbf4f9c"}, {file = "gunicorn-20.0.4-py2.py3-none-any.whl", hash = "sha256:cd4a810dd51bf497552cf3f863b575dabd73d6ad6a91075b65936b151cbf4f9c"},
{file = "gunicorn-20.0.4.tar.gz", hash = "sha256:1904bb2b8a43658807108d59c3f3d56c2b6121a701161de0ddf9ad140073c626"}, {file = "gunicorn-20.0.4.tar.gz", hash = "sha256:1904bb2b8a43658807108d59c3f3d56c2b6121a701161de0ddf9ad140073c626"},
] ]
html5lib = [
{file = "html5lib-1.0.1-py2.py3-none-any.whl", hash = "sha256:20b159aa3badc9d5ee8f5c647e5efd02ed2a66ab8d354930bd9ff139fc1dc0a3"},
{file = "html5lib-1.0.1.tar.gz", hash = "sha256:66cb0dcfdbbc4f9c3ba1a63fdb511ffdbd4f513b2b6d81b80cd26ce6b3fb3736"},
]
ipython = [ ipython = [
{file = "ipython-7.13.0-py3-none-any.whl", hash = "sha256:eb8d075de37f678424527b5ef6ea23f7b80240ca031c2dd6de5879d687a65333"}, {file = "ipython-7.13.0-py3-none-any.whl", hash = "sha256:eb8d075de37f678424527b5ef6ea23f7b80240ca031c2dd6de5879d687a65333"},
{file = "ipython-7.13.0.tar.gz", hash = "sha256:ca478e52ae1f88da0102360e57e528b92f3ae4316aabac80a2cd7f7ab2efb48a"}, {file = "ipython-7.13.0.tar.gz", hash = "sha256:ca478e52ae1f88da0102360e57e528b92f3ae4316aabac80a2cd7f7ab2efb48a"},
@ -311,6 +521,30 @@ pickleshare = [
{file = "pickleshare-0.7.5-py2.py3-none-any.whl", hash = "sha256:9649af414d74d4df115d5d718f82acb59c9d418196b7b4290ed47a12ce62df56"}, {file = "pickleshare-0.7.5-py2.py3-none-any.whl", hash = "sha256:9649af414d74d4df115d5d718f82acb59c9d418196b7b4290ed47a12ce62df56"},
{file = "pickleshare-0.7.5.tar.gz", hash = "sha256:87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca"}, {file = "pickleshare-0.7.5.tar.gz", hash = "sha256:87683d47965c1da65cdacaf31c8441d12b8044cdec9aca500cd78fc2c683afca"},
] ]
pillow = [
{file = "Pillow-7.0.0-cp35-cp35m-macosx_10_6_intel.whl", hash = "sha256:5f3546ceb08089cedb9e8ff7e3f6a7042bb5b37c2a95d392fb027c3e53a2da00"},
{file = "Pillow-7.0.0-cp35-cp35m-manylinux1_i686.whl", hash = "sha256:9d2ba4ed13af381233e2d810ff3bab84ef9f18430a9b336ab69eaf3cd24299ff"},
{file = "Pillow-7.0.0-cp35-cp35m-manylinux1_x86_64.whl", hash = "sha256:ff3797f2f16bf9d17d53257612da84dd0758db33935777149b3334c01ff68865"},
{file = "Pillow-7.0.0-cp35-cp35m-win32.whl", hash = "sha256:c18f70dc27cc5d236f10e7834236aff60aadc71346a5bc1f4f83a4b3abee6386"},
{file = "Pillow-7.0.0-cp35-cp35m-win_amd64.whl", hash = "sha256:875358310ed7abd5320f21dd97351d62de4929b0426cdb1eaa904b64ac36b435"},
{file = "Pillow-7.0.0-cp36-cp36m-macosx_10_6_intel.whl", hash = "sha256:ab76e5580b0ed647a8d8d2d2daee170e8e9f8aad225ede314f684e297e3643c2"},
{file = "Pillow-7.0.0-cp36-cp36m-manylinux1_i686.whl", hash = "sha256:a62ec5e13e227399be73303ff301f2865bf68657d15ea50b038d25fc41097317"},
{file = "Pillow-7.0.0-cp36-cp36m-manylinux1_x86_64.whl", hash = "sha256:8ac6ce7ff3892e5deaab7abaec763538ffd011f74dc1801d93d3c5fc541feee2"},
{file = "Pillow-7.0.0-cp36-cp36m-win32.whl", hash = "sha256:91b710e3353aea6fc758cdb7136d9bbdcb26b53cefe43e2cba953ac3ee1d3313"},
{file = "Pillow-7.0.0-cp36-cp36m-win_amd64.whl", hash = "sha256:bf598d2e37cf8edb1a2f26ed3fb255191f5232badea4003c16301cb94ac5bdd0"},
{file = "Pillow-7.0.0-cp37-cp37m-macosx_10_6_intel.whl", hash = "sha256:5bfef0b1cdde9f33881c913af14e43db69815c7e8df429ceda4c70a5e529210f"},
{file = "Pillow-7.0.0-cp37-cp37m-manylinux1_i686.whl", hash = "sha256:dc058b7833184970d1248135b8b0ab702e6daa833be14035179f2acb78ff5636"},
{file = "Pillow-7.0.0-cp37-cp37m-manylinux1_x86_64.whl", hash = "sha256:c5ed816632204a2fc9486d784d8e0d0ae754347aba99c811458d69fcdfd2a2f9"},
{file = "Pillow-7.0.0-cp37-cp37m-win32.whl", hash = "sha256:54ebae163e8412aff0b9df1e88adab65788f5f5b58e625dc5c7f51eaf14a6837"},
{file = "Pillow-7.0.0-cp37-cp37m-win_amd64.whl", hash = "sha256:87269cc6ce1e3dee11f23fa515e4249ae678dbbe2704598a51cee76c52e19cda"},
{file = "Pillow-7.0.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:0a628977ac2e01ca96aaae247ec2bd38e729631ddf2221b4b715446fd45505be"},
{file = "Pillow-7.0.0-cp38-cp38-manylinux1_i686.whl", hash = "sha256:62a889aeb0a79e50ecf5af272e9e3c164148f4bd9636cc6bcfa182a52c8b0533"},
{file = "Pillow-7.0.0-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:bf4003aa538af3f4205c5fac56eacaa67a6dd81e454ffd9e9f055fff9f1bc614"},
{file = "Pillow-7.0.0-cp38-cp38-win32.whl", hash = "sha256:7406f5a9b2fd966e79e6abdaf700585a4522e98d6559ce37fc52e5c955fade0a"},
{file = "Pillow-7.0.0-cp38-cp38-win_amd64.whl", hash = "sha256:5f7ae9126d16194f114435ebb79cc536b5682002a4fa57fa7bb2cbcde65f2f4d"},
{file = "Pillow-7.0.0-pp373-pypy36_pp73-win32.whl", hash = "sha256:8453f914f4e5a3d828281a6628cf517832abfa13ff50679a4848926dac7c0358"},
{file = "Pillow-7.0.0.tar.gz", hash = "sha256:4d9ed9a64095e031435af120d3c910148067087541131e82b3e8db302f4c8946"},
]
prompt-toolkit = [ prompt-toolkit = [
{file = "prompt_toolkit-3.0.4-py3-none-any.whl", hash = "sha256:859e1b205b6cf6a51fa57fa34202e45365cf58f8338f0ee9f4e84a4165b37d5b"}, {file = "prompt_toolkit-3.0.4-py3-none-any.whl", hash = "sha256:859e1b205b6cf6a51fa57fa34202e45365cf58f8338f0ee9f4e84a4165b37d5b"},
{file = "prompt_toolkit-3.0.4.tar.gz", hash = "sha256:ebe6b1b08c888b84c50d7f93dee21a09af39860144ff6130aadbd61ae8d29783"}, {file = "prompt_toolkit-3.0.4.tar.gz", hash = "sha256:ebe6b1b08c888b84c50d7f93dee21a09af39860144ff6130aadbd61ae8d29783"},
@ -319,10 +553,18 @@ ptyprocess = [
{file = "ptyprocess-0.6.0-py2.py3-none-any.whl", hash = "sha256:d7cc528d76e76342423ca640335bd3633420dc1366f258cb31d05e865ef5ca1f"}, {file = "ptyprocess-0.6.0-py2.py3-none-any.whl", hash = "sha256:d7cc528d76e76342423ca640335bd3633420dc1366f258cb31d05e865ef5ca1f"},
{file = "ptyprocess-0.6.0.tar.gz", hash = "sha256:923f299cc5ad920c68f2bc0bc98b75b9f838b93b599941a6b63ddbc2476394c0"}, {file = "ptyprocess-0.6.0.tar.gz", hash = "sha256:923f299cc5ad920c68f2bc0bc98b75b9f838b93b599941a6b63ddbc2476394c0"},
] ]
pycparser = [
{file = "pycparser-2.20-py2.py3-none-any.whl", hash = "sha256:7582ad22678f0fcd81102833f60ef8d0e57288b6b5fb00323d101be910e35705"},
{file = "pycparser-2.20.tar.gz", hash = "sha256:2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0"},
]
pygments = [ pygments = [
{file = "Pygments-2.6.1-py3-none-any.whl", hash = "sha256:ff7a40b4860b727ab48fad6360eb351cc1b33cbf9b15a0f689ca5353e9463324"}, {file = "Pygments-2.6.1-py3-none-any.whl", hash = "sha256:ff7a40b4860b727ab48fad6360eb351cc1b33cbf9b15a0f689ca5353e9463324"},
{file = "Pygments-2.6.1.tar.gz", hash = "sha256:647344a061c249a3b74e230c739f434d7ea4d8b1d5f3721bc0f3558049b38f44"}, {file = "Pygments-2.6.1.tar.gz", hash = "sha256:647344a061c249a3b74e230c739f434d7ea4d8b1d5f3721bc0f3558049b38f44"},
] ]
pyphen = [
{file = "Pyphen-0.9.5-py2.py3-none-any.whl", hash = "sha256:e172faf10992c8c9d369bdc83e36dbcf1121f4ed0d881f1a0b521935aee583b5"},
{file = "Pyphen-0.9.5.tar.gz", hash = "sha256:3b633a50873156d777e1f1075ba4d8e96a6ad0a3ca42aa3ea9a6259f93f18921"},
]
pytz = [ pytz = [
{file = "pytz-2019.3-py2.py3-none-any.whl", hash = "sha256:1c557d7d0e871de1f5ccd5833f60fb2550652da6be2693c1e02300743d21500d"}, {file = "pytz-2019.3-py2.py3-none-any.whl", hash = "sha256:1c557d7d0e871de1f5ccd5833f60fb2550652da6be2693c1e02300743d21500d"},
{file = "pytz-2019.3.tar.gz", hash = "sha256:b02c06db6cf09c12dd25137e563b31700d3b80fcc4ad23abb7a315f2789819be"}, {file = "pytz-2019.3.tar.gz", hash = "sha256:b02c06db6cf09c12dd25137e563b31700d3b80fcc4ad23abb7a315f2789819be"},
@ -335,6 +577,10 @@ sqlparse = [
{file = "sqlparse-0.3.1-py2.py3-none-any.whl", hash = "sha256:022fb9c87b524d1f7862b3037e541f68597a730a8843245c349fc93e1643dc4e"}, {file = "sqlparse-0.3.1-py2.py3-none-any.whl", hash = "sha256:022fb9c87b524d1f7862b3037e541f68597a730a8843245c349fc93e1643dc4e"},
{file = "sqlparse-0.3.1.tar.gz", hash = "sha256:e162203737712307dfe78860cc56c8da8a852ab2ee33750e33aeadf38d12c548"}, {file = "sqlparse-0.3.1.tar.gz", hash = "sha256:e162203737712307dfe78860cc56c8da8a852ab2ee33750e33aeadf38d12c548"},
] ]
tinycss2 = [
{file = "tinycss2-1.0.2-py3-none-any.whl", hash = "sha256:9fdacc0e22d344ddd2ca053837c133900fe820ae1222f63b79617490a498507a"},
{file = "tinycss2-1.0.2.tar.gz", hash = "sha256:6427d0e3faa0a5e0e8c9f6437e2de26148a7a197a8b0992789f23d9a802788cf"},
]
traitlets = [ traitlets = [
{file = "traitlets-4.3.3-py2.py3-none-any.whl", hash = "sha256:70b4c6a1d9019d7b4f6846832288f86998aa3b9207c6821f3578a6a6a467fe44"}, {file = "traitlets-4.3.3-py2.py3-none-any.whl", hash = "sha256:70b4c6a1d9019d7b4f6846832288f86998aa3b9207c6821f3578a6a6a467fe44"},
{file = "traitlets-4.3.3.tar.gz", hash = "sha256:d023ee369ddd2763310e4c3eae1ff649689440d4ae59d7485eb4cfbbe3e359f7"}, {file = "traitlets-4.3.3.tar.gz", hash = "sha256:d023ee369ddd2763310e4c3eae1ff649689440d4ae59d7485eb4cfbbe3e359f7"},
@ -343,3 +589,11 @@ wcwidth = [
{file = "wcwidth-0.1.8-py2.py3-none-any.whl", hash = "sha256:8fd29383f539be45b20bd4df0dc29c20ba48654a41e661925e612311e9f3c603"}, {file = "wcwidth-0.1.8-py2.py3-none-any.whl", hash = "sha256:8fd29383f539be45b20bd4df0dc29c20ba48654a41e661925e612311e9f3c603"},
{file = "wcwidth-0.1.8.tar.gz", hash = "sha256:f28b3e8a6483e5d49e7f8949ac1a78314e740333ae305b4ba5defd3e74fb37a8"}, {file = "wcwidth-0.1.8.tar.gz", hash = "sha256:f28b3e8a6483e5d49e7f8949ac1a78314e740333ae305b4ba5defd3e74fb37a8"},
] ]
weasyprint = [
{file = "WeasyPrint-51-py3-none-any.whl", hash = "sha256:469974f6e74b1eef71dc56a9b80cc17621f319234d2a4ab656ddd0fd9e66c27f"},
{file = "WeasyPrint-51.tar.gz", hash = "sha256:b3e971973a4f03c1430e6b838b75b5b57630415fcae8666d2be1347630ff6d6a"},
]
webencodings = [
{file = "webencodings-0.5.1-py2.py3-none-any.whl", hash = "sha256:a0af1213f3c2226497a97e2b3aa01a7e4bee4f403f95be16fc9acd2947514a78"},
{file = "webencodings-0.5.1.tar.gz", hash = "sha256:b36a1c245f2d304965eb4e0a82848379241dc04b865afcc4aab16748587e1923"},
]

View file

@ -8,6 +8,7 @@ authors = ["Tomáš Mládek <t@mldk.cz>"]
python = "^3.8" python = "^3.8"
django = "^3.0.4" django = "^3.0.4"
django-model-utils = "^4.0.0" django-model-utils = "^4.0.0"
weasyprint = "^51"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
ipython = "^7.13.0" ipython = "^7.13.0"

View file

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="6.61026mm"
height="8.4858389mm"
viewBox="0 0 23.422181 30.067933"
id="svg2"
version="1.1"
inkscape:version="0.92.4 5da689c313, 2019-01-14"
sodipodi:docname="pile_black.svg">
<defs
id="defs4" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="16"
inkscape:cx="6.434692"
inkscape:cy="16.159642"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1916"
inkscape:window-height="1040"
inkscape:window-x="0"
inkscape:window-y="18"
inkscape:window-maximized="0" />
<metadata
id="metadata7">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title />
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Vrstva 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-15.158962,-12.023409)">
<g
transform="translate(-126.20458,-71.853004)"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="text4254-4">
<path
d="m 141.80015,113.67837 22.1058,0 c 0,-0.4 0.19143,-7.64 0.35143,-9.28 l -1.48,0 -0.71884,2.94125 c -0.4,1.52 -1.24089,3.53125 -1.90607,4.12107 -0.52,0.44 -5.51232,0.45768 -6.11232,0.45768 l -0.84,0 c -2.88,0 -3.92,-0.64 -3.92,-1.56 0,-0.36 0.08,-17.400002 0.28,-23.120002 0.04,-1.28 1.4,-1.44 3.28,-1.56 l 0.56,-0.04 0,-1.48 -11.6,0 0,1.48 0.56,0.04 c 1.88,0.12 2.68,0.28 2.76,1.56 0.24,7.72 0.28,22.160002 0.28,23.120002 0,1.48 -1.48,1.68 -3.6,1.84 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Prociono;-inkscape-font-specification:Prociono;fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4321"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccsssccccccccscc" />
</g>
<g
transform="matrix(1.0042803,0,0,0.99573794,-126.20458,-71.853004)"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:39.83314133px;line-height:125%;font-family:Prociono;-inkscape-font-specification:Prociono;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.49791428;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="text4246-5">
<path
d="m 141.01002,114.16599 13.62293,0 0,-1.35432 -1.51366,-0.1195 c -2.11115,-0.15934 -4.38164,-0.3585 -4.38164,-1.83233 0,-0.31866 0.0398,-4.81981 0.0797,-10.15745 0.99582,0.43817 2.78832,0.63733 4.26214,0.63733 7.60813,0 10.75495,-5.576639 10.75495,-8.723457 0,-3.903648 -1.63316,-8.086127 -8.20563,-8.086127 l -0.79666,0 c -1.87216,0 -1.82308,0.08449 -7.91755,0.08449 -2.11116,0 -4.88824,0.03242 -5.62572,0.154505 l -0.0445,1.204823 0.55767,0.03983 c 1.87121,0.133646 2.7531,0.547836 2.79293,1.822496 0.0797,2.708654 0.1195,6.134304 0.1195,9.559954 0,8.086136 -0.0797,12.109286 -0.1195,13.463606 -0.0398,1.51366 -1.63316,1.71283 -3.58498,1.83233 l 0,1.47382 z m 7.84713,-16.01292 c 0.0398,-3.42565 0.1195,-8.444626 0.19916,-10.754948 l 0.43817,-0.438165 c 1.03566,-0.358498 3.98331,-0.477997 5.6563,-0.477997 0.239,0 0.717,0.159332 1.15517,0.358498 3.02731,1.473826 3.06715,4.301979 3.06715,6.452969 0,2.071323 -0.15933,6.054637 -5.93514,6.054637 -2.35016,0 -3.94348,-0.63733 -4.58081,-1.194994 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Prociono;-inkscape-font-specification:Prociono;fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.49791428;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4318"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccscsssssccscscccccccscssc" />
</g>
<g
transform="matrix(0.99946441,0,0,1.0005359,-126.20458,-71.853004)"
style="font-style:normal;font-weight:normal;font-size:40.02097321px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="text4258-2">
<path
d="m 141.70753,113.63314 22.2854,-0.0158 c 0,-0.40021 0.20011,-7.644 0.36019,-9.28486 l -1.48078,0 -0.56029,2.16113 c -0.40021,1.5208 -1.04054,4.0021 -2.04107,4.88256 -0.44023,0.36019 -3.12164,0.48025 -4.2022,0.48025 -4.80252,0 -6.6835,-0.24013 -6.6835,-1.56082 0,-0.36019 0,-5.56291 0.08,-11.486017 1.16061,0.120063 7.16375,-0.160084 8.80461,1.040545 l 0.68036,0 0.40021,-2.961552 c -0.84044,0.04002 -7.48392,0.200105 -9.84516,0.200105 0.04,-3.441804 0.08,-7.203775 0.16008,-9.524992 0.04,-1.160608 1.00053,-1.360713 3.28172,-1.360713 1.76093,0 4.08214,0 5.04265,0.120063 0.60031,0.08004 0.9605,0.120063 1.48077,0.240126 0.40021,0.280147 0.52027,0.640336 0.64034,1.040545 0.04,0.08004 0.68035,3.241699 0.88046,4.322265 l 1.36071,0 c 0.04,-0.560293 0.9605,-6.963649 1.08057,-7.40388 l -0.48025,-0.44023 c 0,0 -10.32542,0.04002 -10.52552,0.04002 -1.20063,0.08004 -3.23191,-0.0032 -5.03285,-0.0032 -2.08109,0 -4.42,0.09844 -5.50057,0.01839 l 0.008,1.425563 0.5603,0.04002 c 1.84096,0.120063 2.6814,0.280147 2.72142,1.560818 0.12007,2.921531 0.16009,6.483397 0.16009,9.925201 0,6.123213 -0.12007,11.926253 -0.16009,13.206923 0,1.5208 -1.4745,1.73668 -3.47554,1.85675 3e-5,0.49358 -2e-5,0.98729 -6e-5,1.48079 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Prociono;-inkscape-font-specification:Prociono;fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4315"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccccssccccccsccccccccsccccsccc" />
</g>
<g
transform="translate(-126.20458,-71.853004)"
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.5;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="text4250-8">
<path
inkscape:connector-curvature="0"
d="m 149.03309,113.67837 11.08,0 0,-1.48 c -2.08,-0.16 -3.6,-0.36 -3.6,-1.84 0,-0.36 0.08,-17.400002 0.28,-23.120002 0.04,-1.28 0.88,-1.44 2.76,-1.56 l 0.56,-0.04 0,-1.48 -11.08,0 0,1.48 0.56,0.04 c 1.88,0.12 2.72,0.28 2.76,1.56 0.24,7.96 0.28,22.800002 0.28,23.120002 0,1.52 -1.6,1.72 -3.6,1.84 l 0,1.48 z"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:Prociono;-inkscape-font-specification:Prociono;fill:#000000;fill-opacity:0;stroke:#000000;stroke-width:0.5;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path4312" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.9 KiB

View file

@ -36,8 +36,8 @@
</div> </div>
{% endif %} {% endif %}
{# <div class="doc-link"><span class="doc-link-intro">Get (document with) print label: </span>#} <div class="doc-link"><span class="doc-link-intro">Get print label: </span>
{# <a href="/label.php?id=<?= $doc[" ID"] ?>">https://pile.sdbs.cz/label.php?id=<?= $doc["ID"] ?></a></div>#} <a href="{% url "pile:label" document.id %}">{% url "pile:label" document.id %}</a></div>
{% if document.url %} {% if document.url %}
<div class="doc-link"> <div class="doc-link">

View file

@ -0,0 +1,140 @@
{% load static %}
<head>
<title>LABEL FOR "{{ document.title }}"</title>
<!--suppress CssNoGenericFontName -->
<style>
body {
font-family: prociono;
font-size: 14px;
}
h1, h2, h3 {
margin: 0;
padding: 0;
bookmark-level: none;
}
h1, h2 {
font-size: 24px;
}
a {
color: black;
text-decoration: none;
}
.exlibris {
text-align: center;
margin-bottom: 10px;
}
.label-outer {
width: 100%;
border: 5px solid black;
padding: 10px;
}
.label-column {
float: left;
}
.label-stamp-outer {
width: 20%;
}
.label-stamp {
width: 100%;
border: 2px solid black;
}
#pile-logo {
width: 80%;
padding: 10px 10%;
}
.label-stamp-subtitle {
text-align: center;
width: 100%;
margin-bottom: 5px;
font-size: 20px;
margin-top: -12px; /* prociono specific */
}
.label-text {
float: right;
width: 77.5%;
}
.label-title {
margin: 0;
padding: 0;
}
.label-otherinfo {
font-size: 14px;
}
.label-description {
text-align: justify;
margin-top: 0;
padding-top: 0;
}
.label-footer {
width: 100%;
text-align: right;
clear: both;
}
.absolute-footer {
width: 100%;
position: absolute;
text-align: center;
bottom: 0;
left: 0;
}
</style>
</head>
<body>
<h1 class="exlibris">ex libris /-\ pile</h1>
<div class="label-outer">
<div class="label-upper">
<div class="label-stamp-outer">
<div class="label-column label-stamp">
<img id="pile-logo" src="{% static "pile_black.svg" %}" alt="/-\ Pile"/>
<div class="label-stamp-subtitle">#{{ document.id|stringformat:"04d" }}</div>
</div>
</div>
<div class="label-column label-text">
<h2 class="label-title">{{ document.title }}</h2>
<h3 class="label-otherinfo">
{% if document.author %}
By {{ document.author }}
{% endif %}
{% if document.published %}
<div class="label-otherinfo-date">(Published: {{ document.published }})</div>
{% endif %}
</h3>
<p class="label-description">{{ document.description }}</p>
</div>
</div>
<div class="label-footer">
{% if document.tags.count > 0 %}
<div class="label-footer-tags">Filed under:
{% for tag in document.tags.all %}
{{ tag.name }}
{% endfor %}
{% endif %}
<div class="label-footer-url">
Available at:
<a href="https://pile.sdbs.cz/item/{{ document.id }}">https://pile.sdbs.cz/item/{{ document.id }}</a>
</div>
</div>
</div>
<div class="absolute-footer">
read or share
</div>
</body>

View file

@ -7,5 +7,6 @@ urlpatterns = [
path('', views.IndexView.as_view(), name='index'), path('', views.IndexView.as_view(), name='index'),
path('tag/<name_or_id>', views.TagView.as_view(), name='tag'), path('tag/<name_or_id>', views.TagView.as_view(), name='tag'),
path('item/<int:document_id>', views.DocumentView.as_view(), name='document'), path('item/<int:document_id>', views.DocumentView.as_view(), name='document'),
path('label/<int:document_id>', views.DocumentWithLabel.as_view(), name='label'),
path('feed', views.RecentlyUploadedFeed()) path('feed', views.RecentlyUploadedFeed())
] ]

View file

@ -1,16 +1,20 @@
# Create your views here. # Create your views here.
import io
from operator import itemgetter from operator import itemgetter
import weasyprint
from django.contrib.syndication.views import Feed from django.contrib.syndication.views import Feed
from django.core.exceptions import ObjectDoesNotExist from django.core.exceptions import ObjectDoesNotExist
from django.http import Http404 from django.http import Http404, FileResponse
from django.template.loader import render_to_string
from django.utils.text import slugify
from django.views import View
from django.views.generic import TemplateView from django.views.generic import TemplateView
from sdbs_pile.pile.models import Tag, Document from sdbs_pile.pile.models import Tag, Document
class BasePileView(TemplateView): class BasePileViewMixin(View):
@property @property
def include_hidden(self): def include_hidden(self):
return self.request.user.has_perm('document.see_hidden') return self.request.user.has_perm('document.see_hidden')
@ -19,6 +23,8 @@ class BasePileView(TemplateView):
def documents(self): def documents(self):
return Document.objects if self.include_hidden else Document.exclude_hidden return Document.objects if self.include_hidden else Document.exclude_hidden
class BasePileView(BasePileViewMixin, TemplateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
tags = list(Tag.objects.all()) tags = list(Tag.objects.all())
tags.sort(key=lambda tag: tag.name) tags.sort(key=lambda tag: tag.name)
@ -91,6 +97,24 @@ class DocumentView(BasePileView):
} }
class DocumentWithLabel(BasePileViewMixin):
def get(self, request, document_id: int):
try:
document = self.documents.get(pk=document_id)
except ObjectDoesNotExist:
raise Http404
label_html = render_to_string("label.html", {'document': document})
stream = io.BytesIO()
weasyprint.HTML(base_url=request.build_absolute_uri(), string=label_html).write_pdf(stream)
stream.seek(0)
return FileResponse(stream,
filename=f"pile_{document.id}__{slugify(document.title)}.pdf",
content_type="application/pdf")
class RecentlyUploadedFeed(Feed): class RecentlyUploadedFeed(Feed):
title = "The /-\\ pile" title = "The /-\\ pile"
link = "https://pile.sbds.cz" link = "https://pile.sbds.cz"