mirror of
https://github.com/django-components/django-components.git
synced 2025-08-05 06:48:00 +00:00

* refactor: update docs and tests to use get_template_data() * refactor: fix linting * docs: add note about difference between the two methods
16 lines
484 B
Python
16 lines
484 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_file = "staticfiles.html"
|
|
|
|
class Media:
|
|
js = "staticfiles.js"
|
|
css = "staticfiles.css"
|
|
|
|
def get_template_data(self, args, kwargs, slots, context) -> Dict[str, Any]:
|
|
return {"variable": kwargs["variable"]}
|