django-components/tests/components/staticfiles/staticfiles.py
Juro Oravec e1382d3ccd
refactor: Remove safer_staticfiles, replace STATICFILES_DIRS with COMPONENTS.dirs, support [app]/components (#652)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2024-09-11 08:45:55 +02:00

16 lines
470 B
Python

from typing import Any, Dict
from django_components import Component, register
# Used for testing the staticfiles finder in `test_staticfiles.py`
@register("staticfiles_component")
class RelativeFileWithPathObjComponent(Component):
template_name = "staticfiles.html"
class Media:
js = "staticfiles.js"
css = "staticfiles.css"
def get_context_data(self, variable, *args, **kwargs) -> Dict[str, Any]:
return {"variable": variable}