2024-12-10 22:05:36 +00:00
|
|
|
"""
|
|
|
|
Decorators.
|
|
|
|
"""
|
|
|
|
|
2020-03-22 11:46:10 +00:00
|
|
|
from cms import registry
|
2020-01-02 18:32:15 +00:00
|
|
|
|
2021-07-03 23:59:48 +00:00
|
|
|
|
2020-03-22 11:46:10 +00:00
|
|
|
def page_model(cls):
|
2024-12-10 22:05:36 +00:00
|
|
|
"""
|
|
|
|
Decorator to register the Page model.
|
|
|
|
"""
|
|
|
|
|
2020-03-22 11:46:10 +00:00
|
|
|
registry.page_class = cls
|
|
|
|
return cls
|
2020-03-21 17:49:41 +00:00
|
|
|
|
2021-07-03 23:59:48 +00:00
|
|
|
|
2020-03-22 11:46:10 +00:00
|
|
|
def section_model(cls):
|
2024-12-10 22:05:36 +00:00
|
|
|
"""
|
|
|
|
Decorator to register the Section model.
|
|
|
|
"""
|
|
|
|
|
2020-03-22 11:46:10 +00:00
|
|
|
registry.section_class = cls
|
|
|
|
return cls
|
2020-03-21 17:49:41 +00:00
|
|
|
|
2021-07-03 23:59:48 +00:00
|
|
|
|
2020-03-22 11:46:10 +00:00
|
|
|
def section_view(cls):
|
2024-12-10 22:05:36 +00:00
|
|
|
"""
|
|
|
|
Decorator to register a view for a specific section.
|
|
|
|
"""
|
|
|
|
|
2020-03-22 18:57:48 +00:00
|
|
|
registry.view_per_type[cls.__name__.lower()] = cls
|
|
|
|
registry.section_types.append((cls.__name__.lower(), cls.verbose_name))
|
2020-03-22 11:46:10 +00:00
|
|
|
return cls
|