File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 1515
1616@dataclass
1717class AppSettings :
18+ COMPONENT_DIRS : list [str ] = field (default_factory = lambda : ["bird" ])
1819 ENABLE_AUTO_CONFIG : bool = True
1920 _template_configurator : TemplateConfigurator = field (init = False )
2021
Original file line number Diff line number Diff line change 88from django .template .base import Parser
99from django .template .base import Token
1010from django .template .context import Context
11- from django .template .loader import render_to_string
11+ from django .template .loader import select_template
1212from django .utils .safestring import SafeString
1313from django .utils .safestring import mark_safe
1414
1515from django_bird ._typing import override
16+ from django_bird .conf import app_settings
1617
1718register = template .Library ()
1819
@@ -61,7 +62,11 @@ def render(self, context: Context) -> SafeString:
6162 },
6263 }
6364
64- return render_to_string (f"bird/{ self .name } .html" , component_context )
65+ template_names = [
66+ f"{ directory } /{ self .name } .html" for directory in app_settings .COMPONENT_DIRS
67+ ]
68+ template = select_template (template_names )
69+ return template .render (component_context )
6570
6671 def render_slots (self , context : Context ) -> dict [str , str ]:
6772 if self .nodelist is None :
You can’t perform that action at this time.
0 commit comments