mirror of
https://github.com/django-components/django-components.git
synced 2025-08-03 13:58:16 +00:00
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>
This commit is contained in:
parent
728b4ffad7
commit
e1382d3ccd
34 changed files with 1034 additions and 264 deletions
|
@ -6,7 +6,7 @@ class Calendar(Component):
|
|||
# Templates inside `[your apps]/components` dir and `[project root]/components` dir
|
||||
# will be automatically found.
|
||||
#
|
||||
# `template_name` can be relative to dir where `calendar.py` is, or relative to STATICFILES_DIRS
|
||||
# `template_name` can be relative to dir where `calendar.py` is, or relative to COMPONENTS.dirs
|
||||
template_name = "calendar/calendar.html"
|
||||
# Or
|
||||
# def get_template_name(context):
|
||||
|
@ -19,10 +19,11 @@ class Calendar(Component):
|
|||
}
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
context = {
|
||||
"date": request.GET.get("date", ""),
|
||||
}
|
||||
return self.render_to_response(context)
|
||||
return self.render_to_response(
|
||||
kwargs={
|
||||
"date": request.GET.get("date", ""),
|
||||
},
|
||||
)
|
||||
|
||||
class Media:
|
||||
css = "calendar/calendar.css"
|
||||
|
@ -34,7 +35,7 @@ class CalendarRelative(Component):
|
|||
# Templates inside `[your apps]/components` dir and `[project root]/components` dir
|
||||
# will be automatically found.
|
||||
#
|
||||
# `template_name` can be relative to dir where `calendar.py` is, or relative to STATICFILES_DIRS
|
||||
# `template_name` can be relative to dir where `calendar.py` is, or relative to COMPONENTS.dirs
|
||||
template_name = "calendar.html"
|
||||
# Or
|
||||
# def get_template_name(context):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue