django-simplecms/cms/decorators.py

21 wiersze
497 B
Python
Czysty Zwykły widok Historia

from cms import registry
2021-07-03 23:59:48 +00:00
def page_model(cls):
2021-07-03 23:59:48 +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):
2021-07-03 23:59:48 +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):
2021-07-03 23:59:48 +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