mirror of
https://github.com/django-components/django-components.git
synced 2025-09-09 23:46:17 +00:00
A simple ComponentRegistry to store components.
This commit is contained in:
parent
22b00a4a62
commit
313852ce21
4 changed files with 33 additions and 0 deletions
9
django_components/component.py
Normal file
9
django_components/component.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
class ComponentRegistry(object):
|
||||
def __init__(self):
|
||||
self._registry = {} # component name -> component_class mapping
|
||||
|
||||
def register(self, name=None, component=None):
|
||||
self._registry[name] = component
|
||||
|
||||
# This variable represents the global component registry
|
||||
registry = ComponentRegistry()
|
Loading…
Add table
Add a link
Reference in a new issue