11from collections import defaultdict
2+ from collections .abc import Iterator
23import importlib
34import os
4- from collections .abc import Iterator
55import warnings
66
77from django import forms
1515from djangocms_frontend .component_base import CMSFrontendComponent
1616
1717
18- def find_cms_component_templates () -> list [tuple [str , str ]]:
18+ def find_cms_component_templates (subfolder : str ) -> list [tuple [str , str ]]:
1919 templates = []
2020 for app in apps .get_app_configs ():
21- app_template_dir = os .path .join (app .path , "templates" , app .label , "cms_components" )
21+ app_template_dir = os .path .join (app .path , "templates" , app .label , subfolder )
2222 if os .path .exists (app_template_dir ):
2323 for root , _ , files in os .walk (app_template_dir ):
2424 for file in files :
2525 if file .endswith (".html" ) or file .endswith (".htm" ):
2626 relative_path = os .path .relpath (os .path .join (root , file ), app_template_dir )
27- templates .append ((app .module .__name__ , f"{ app .label } /cms_components /{ relative_path } " ))
27+ templates .append ((app .module .__name__ , f"{ app .label } /{ subfolder } /{ relative_path } " ))
2828 return templates
2929
3030
@@ -43,7 +43,7 @@ class CMSAutoComponentDiscovery:
4343
4444 def __init__ (self , register_to ):
4545 self .default_field_context .update (settings .COMPONENT_FIELDS )
46- templates = find_cms_component_templates ()
46+ templates = find_cms_component_templates (settings . COMPONENT_FOLDER )
4747 auto_components = self .scan_templates_for_component_declaration (templates )
4848 for component in auto_components :
4949 register_to .register (component )
0 commit comments