From 159585e6cd1f49fd859bf067b2afe8ea068eb3ab Mon Sep 17 00:00:00 2001 From: Gabriel Augendre Date: Mon, 4 Jan 2021 17:58:41 +0100 Subject: [PATCH] Switch to django-compressor --- articles/models.py | 12 --- .../templates/articles/article_detail.html | 4 +- articles/templates/articles/article_list.html | 4 +- articles/templates/articles/base.html | 24 +++++- .../snippets/load_styles_and_scripts.html | 16 ---- articles/tests/conftest.py | 6 -- articles/tests/test_models.py | 40 --------- blog/settings.py | 19 ++++- docker/run.sh | 1 - poetry.lock | 82 +++++++++++++------ pyproject.toml | 3 +- 11 files changed, 97 insertions(+), 114 deletions(-) delete mode 100644 articles/templates/articles/snippets/load_styles_and_scripts.html diff --git a/articles/models.py b/articles/models.py index 1b274d5..22a97c1 100644 --- a/articles/models.py +++ b/articles/models.py @@ -121,18 +121,6 @@ class Article(models.Model): filter(None, map(lambda k: k.strip().lower(), self.keywords.split(","))) ) - @cached_property - def get_minified_custom_css(self): - def reducer(res, next_char): - if len(res) == 0: - return next_char - if res[-1] == next_char == " ": - return res - return res + next_char - - css = self.custom_css.replace("\n", " ") - return reduce(reducer, css, "") - def get_admin_url(self): content_type = ContentType.objects.get_for_model(self.__class__) return reverse( diff --git a/articles/templates/articles/article_detail.html b/articles/templates/articles/article_detail.html index 72f9fa9..9c5f076 100644 --- a/articles/templates/articles/article_detail.html +++ b/articles/templates/articles/article_detail.html @@ -1,8 +1,8 @@ {% extends 'articles/base.html' %} -{% block append_header %} +{% block append_css %} {% endblock %} diff --git a/articles/templates/articles/article_list.html b/articles/templates/articles/article_list.html index 8eb3f5a..2f1d137 100644 --- a/articles/templates/articles/article_list.html +++ b/articles/templates/articles/article_list.html @@ -1,8 +1,8 @@ {% extends 'articles/base.html' %} -{% block append_header %} +{% block append_css %}