django-simplecms/cms/decorators.py

34 wiersze
554 B
Python
Czysty Zwykły widok Historia

2024-12-10 22:05:36 +00:00
"""
Decorators.
"""
from cms import registry
2021-07-03 23:59:48 +00:00
def page_model(cls):
2024-12-10 22:05:36 +00:00
"""
Decorator to register the Page model.
"""
registry.page_class = cls
return cls
2021-07-03 23:59:48 +00:00
def section_model(cls):
2024-12-10 22:05:36 +00:00
"""
Decorator to register the Section model.
"""
registry.section_class = cls
return cls
2021-07-03 23:59:48 +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))
return cls