mirror of
https://github.com/django-components/django-components.git
synced 2025-08-31 19:27:19 +00:00
feat: allow to configure media cache (for JS and CSS files) (#946)
This commit is contained in:
parent
bb61ff42eb
commit
48bae51ab9
14 changed files with 305 additions and 73 deletions
|
@ -30,12 +30,15 @@ class BaseTestCase(SimpleTestCase):
|
|||
super().tearDown()
|
||||
registry.clear()
|
||||
|
||||
from django_components.template import template_cache
|
||||
from django_components.cache import component_media_cache, template_cache
|
||||
|
||||
# NOTE: There are 1-2 tests which check Templates, so we need to clear the cache
|
||||
if template_cache:
|
||||
template_cache.clear()
|
||||
|
||||
if component_media_cache:
|
||||
component_media_cache.clear()
|
||||
|
||||
from django_components.component import component_node_subclasses_by_name
|
||||
component_node_subclasses_by_name.clear()
|
||||
|
||||
|
@ -180,11 +183,14 @@ def parametrize_context_behavior(cases: List[ContextBehParam], settings: Optiona
|
|||
self._start_gen_id_patch()
|
||||
|
||||
# Reset template cache
|
||||
from django_components.template import template_cache
|
||||
from django_components.cache import component_media_cache, template_cache
|
||||
|
||||
if template_cache: # May be None if the cache was not initialized
|
||||
template_cache.clear()
|
||||
|
||||
if component_media_cache:
|
||||
component_media_cache.clear()
|
||||
|
||||
from django_components.component import component_node_subclasses_by_name
|
||||
component_node_subclasses_by_name.clear()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue