django-simplecms/cms/decorators.py

18 wiersze
494 B
Python
Czysty Zwykły widok Historia

from cms import registry
def page_model(cls):
'''Decorator to register the Page model'''
registry.page_class = cls
return cls
def section_model(cls):
'''Decorator to register the Section model'''
registry.section_class = cls
return cls
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))
return cls