refactor: usage notes + tests for safer_staticfiles (#538)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Juro Oravec 2024-07-08 07:25:03 +02:00 committed by GitHub
parent 3dadba6636
commit 23d91218bd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 226 additions and 4 deletions

View file

@ -0,0 +1,16 @@
from typing import Any, Dict
from django_components import component
# Used for testing the safer_staticfiles app in `test_safer_staticfiles.py`
@component.register("safer_staticfiles_component")
class RelativeFileWithPathObjComponent(component.Component):
template_name = "safer_staticfiles.html"
class Media:
js = "safer_staticfiles.js"
css = "safer_staticfiles.css"
def get_context_data(self, variable, *args, **kwargs) -> Dict[str, Any]:
return {"variable": variable}