2020-03-22 11:46:10 +00:00
|
|
|
from cms import registry
|
2020-01-02 18:32:15 +00:00
|
|
|
|
2020-03-22 11:46:10 +00:00
|
|
|
def page_model(cls):
|
|
|
|
'''Decorator to register the Page model'''
|
|
|
|
registry.page_class = cls
|
|
|
|
return cls
|
2020-03-21 17:49:41 +00:00
|
|
|
|
2020-03-22 11:46:10 +00:00
|
|
|
def section_model(cls):
|
|
|
|
'''Decorator to register the Section model'''
|
|
|
|
registry.section_class = cls
|
|
|
|
return cls
|
2020-03-21 17:49:41 +00:00
|
|
|
|
2020-03-22 11:46:10 +00:00
|
|
|
def section_view(cls):
|
|
|
|
'''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
|