mirror of
https://github.com/django-components/django-components.git
synced 2025-09-10 16:06:18 +00:00
* Add 'default' slot option + implicit fills; tests; docs * Differentiate between standard fillnodes and implicitfillnodes on type lvl * Reworking slot-fill rendering logic. Simplifying component interfact. Add new get_string_template method * First working implementation of chainmap instead of stacks for slot resolution * Stop passing FillNode to Component initalizer -> better decoupling * Treat fill name and alias and component name as filterexpression, dropping namedvariable * Name arg of if_filled tags and slots must be string literal
This commit is contained in:
parent
349e9fe65f
commit
2d86f042da
11 changed files with 843 additions and 422 deletions
|
@ -34,3 +34,24 @@ class ComponentRegistry(object):
|
|||
|
||||
def clear(self):
|
||||
self._registry = {}
|
||||
|
||||
|
||||
# This variable represents the global component registry
|
||||
registry = ComponentRegistry()
|
||||
|
||||
|
||||
def register(name):
|
||||
"""Class decorator to register a component.
|
||||
|
||||
Usage:
|
||||
|
||||
@register("my_component")
|
||||
class MyComponent(component.Component):
|
||||
...
|
||||
"""
|
||||
|
||||
def decorator(component):
|
||||
registry.register(name=name, component=component)
|
||||
return component
|
||||
|
||||
return decorator
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue