Skip to content

Commit ac28efc

Browse files
committed
docs: Update template component name validation
1 parent ac3ea37 commit ac28efc

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docs/source/tutorial/template_components.rst

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ Simplified Component Creation with Templates
1010

1111
.. versionadded:: 2.1
1212

13-
**Template components** are the easiest approach to creating or porting your own custom
13+
**Template components** are the easiest approach to creating or porting your own custom
1414
frontend components, allowing you to define custom components **using django templates,
15-
without needing to write any Python code**.
15+
without needing to write any Python code**.
1616

1717

1818
Example Hero Template Component
@@ -104,6 +104,11 @@ by django CMS to identify the plugin later. The ``name`` parameter is used to di
104104
component in the CMS admin interface. Internally the command declares a ``CMSFrontendComponent``
105105
class. All named arguments are added to the component's Meta class.
106106

107+
.. note::
108+
The component name (the first argument to ``{% cms_component %}``) must be a valid Python identifier.
109+
This means it should start with a letter or underscore, followed by letters, digits, or underscores,
110+
and cannot contain spaces or special characters like hyphens.
111+
107112
Only one ``{% cms_component %}`` tag is allowed per template file.
108113

109114
The first part is the declarative part of the template:

0 commit comments

Comments
 (0)