Change minify-html details to be more spec compliant
This commit is contained in:
parent
b89b9d0797
commit
514e609973
3 changed files with 11 additions and 2 deletions
9
website/common/middleware.py
Normal file
9
website/common/middleware.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
from django_minify_html.middleware import MinifyHtmlMiddleware
|
||||
|
||||
|
||||
class CustomMinifyHtmlMiddleware(MinifyHtmlMiddleware):
|
||||
minify_args = {
|
||||
"do_not_minify_doctype": True,
|
||||
"ensure_spec_compliant_unquoted_attribute_values": True,
|
||||
"keep_spaces_between_attributes": True,
|
||||
}
|
|
@ -38,7 +38,7 @@ class SearchPageTestCase(TestCase):
|
|||
|
||||
self.assertEqual(search_input.attrs["name"], "q")
|
||||
self.assertEqual(search_input.attrs["hx-get"], "results/")
|
||||
self.assertEqual(search_input.attrs.get("value", ""), "")
|
||||
self.assertNotIn("value", search_input.attrs) # Because of minify-html
|
||||
|
||||
self.assertEqual(len(soup.select(search_input.attrs["hx-target"])), 1)
|
||||
self.assertEqual(len(soup.select(search_input.attrs["hx-indicator"])), 2)
|
||||
|
|
|
@ -100,7 +100,7 @@ MIDDLEWARE = [
|
|||
"corsheaders.middleware.CorsMiddleware",
|
||||
"enforce_host.EnforceHostMiddleware",
|
||||
"whitenoise.middleware.WhiteNoiseMiddleware",
|
||||
"django_minify_html.middleware.MinifyHtmlMiddleware",
|
||||
"website.common.middleware.CustomMinifyHtmlMiddleware",
|
||||
"django.middleware.common.CommonMiddleware",
|
||||
"django.contrib.sessions.middleware.SessionMiddleware",
|
||||
"django.middleware.csrf.CsrfViewMiddleware",
|
||||
|
|
Loading…
Reference in a new issue