mirror of
https://github.com/django-components/django-components.git
synced 2025-09-27 07:59:08 +00:00
Make registering a component with a decorator the default.
This commit is contained in:
parent
b9446c2818
commit
c6b20e4cb0
1 changed files with 1 additions and 4 deletions
|
@ -150,7 +150,7 @@ Inside this file we create a Component by inheriting from the Component class an
|
|||
```python
|
||||
from django_components import component
|
||||
|
||||
|
||||
@component.register("calendar")
|
||||
class Calendar(component.Component):
|
||||
def context(self, date):
|
||||
return {
|
||||
|
@ -163,9 +163,6 @@ class Calendar(component.Component):
|
|||
class Media:
|
||||
css = {'all': ['[your app]/components/calendar/calendar.css']}
|
||||
js = ['[your app]/components/calendar/calendar.js']
|
||||
|
||||
|
||||
component.registry.register(name="calendar", component=Calendar)
|
||||
```
|
||||
|
||||
And voilá!! We've created our first component.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue