docs: add register decorator to Calendar class in Quickstart section (#1284)

This commit is contained in:
Antoliny Lee 2025-07-07 23:45:06 +09:00 committed by GitHub
parent 59e5fb3b38
commit 9a4f835201
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 5 deletions

View file

@ -24,8 +24,9 @@ A component in django-components can be as simple as a Django template and Pytho
```py ```py
# components/calendar/calendar.py # components/calendar/calendar.py
from django_components import Component from django_components import Component, register
@register("calendar")
class Calendar(Component): class Calendar(Component):
template_file = "calendar.html" template_file = "calendar.html"
``` ```
@ -56,8 +57,9 @@ document.querySelector(".calendar").onclick = () => {
```py ```py
# components/calendar/calendar.py # components/calendar/calendar.py
from django_components import Component from django_components import Component, register
@register("calendar")
class Calendar(Component): class Calendar(Component):
template_file = "calendar.html" template_file = "calendar.html"
js_file = "calendar.js" js_file = "calendar.js"

View file

@ -35,8 +35,9 @@ document.querySelector(".calendar").onclick = function () {
``` ```
```py title="calendar.py" ```py title="calendar.py"
from django_components import Component from django_components import Component, register
@register("calendar")
class Calendar(Component): class Calendar(Component):
template_file = "calendar.html" template_file = "calendar.html"
js_file = "calendar.js" js_file = "calendar.js"

View file

@ -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" ```py title="components/calendar/calendar.py"
from django_components import Component from django_components import Component, register
@register("calendar")
class Calendar(Component): class Calendar(Component):
template_file = "calendar.html" template_file = "calendar.html"
``` ```
@ -46,8 +47,9 @@ document.querySelector(".calendar").onclick = () => {
``` ```
```py title="components/calendar/calendar.py" ```py title="components/calendar/calendar.py"
from django_components import Component from django_components import Component, register
@register("calendar")
class Calendar(Component): class Calendar(Component):
template_file = "calendar.html" template_file = "calendar.html"
js_file = "calendar.js" js_file = "calendar.js"