diff --git a/README.md b/README.md index 40d5d15d..8df3262e 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,9 @@ A component in django-components can be as simple as a Django template and Pytho ```py # components/calendar/calendar.py -from django_components import Component +from django_components import Component, register +@register("calendar") class Calendar(Component): template_file = "calendar.html" ``` @@ -56,8 +57,9 @@ document.querySelector(".calendar").onclick = () => { ```py # components/calendar/calendar.py -from django_components import Component +from django_components import Component, register +@register("calendar") class Calendar(Component): template_file = "calendar.html" js_file = "calendar.js" diff --git a/docs/getting_started/your_first_component.md b/docs/getting_started/your_first_component.md index 21b403af..328c8737 100644 --- a/docs/getting_started/your_first_component.md +++ b/docs/getting_started/your_first_component.md @@ -35,8 +35,9 @@ document.querySelector(".calendar").onclick = function () { ``` ```py title="calendar.py" -from django_components import Component +from django_components import Component, register +@register("calendar") class Calendar(Component): template_file = "calendar.html" js_file = "calendar.js" diff --git a/docs/overview/welcome.md b/docs/overview/welcome.md index 6c16cbc6..d703b048 100644 --- a/docs/overview/welcome.md +++ b/docs/overview/welcome.md @@ -18,8 +18,9 @@ A component in django-components can be as simple as a Django template and Pytho ``` ```py title="components/calendar/calendar.py" -from django_components import Component +from django_components import Component, register +@register("calendar") class Calendar(Component): template_file = "calendar.html" ``` @@ -46,8 +47,9 @@ document.querySelector(".calendar").onclick = () => { ``` ```py title="components/calendar/calendar.py" -from django_components import Component +from django_components import Component, register +@register("calendar") class Calendar(Component): template_file = "calendar.html" js_file = "calendar.js"