This is the base class for your CMS models.
Provide a simple interface for getting all content blocks for a region.
alias of ContentProxy
Return the concrete content type for an abstract content type:
from feincms.content.video.models import VideoContent
concrete_type = Page.content_type_for(VideoContent)
Copy all content blocks over to another CMS base object. (Must be of the same type, but this is not enforced. It will crash if you try to copy content from another CMS base type.)
This is the method you’ll use to create concrete content types.
If the CMS base class is page.models.Page, its database table will be page_page. A concrete content type which is created from ImageContent will use page_page_imagecontent as its table.
If you want a content type only available in a subset of regions, you can pass a list/tuple of region keys as regions. The content type will only appear in the corresponding tabs in the item editor.
You can pass additional keyword arguments to this factory function. These keyword arguments will be passed on to the concrete content type, provided that it has a initialize_type classmethod. This is used f.e. in MediaFileContent to pass a set of possible media positions (f.e. left, right, centered) through to the content type.
Call the register function of an extension. You must override this if you provide a custom ModelAdmin class and want your extensions to be able to patch stuff in.
Register a list of regions. Only use this if you do not want to use multiple templates with this model (read: not use register_templates):
BlogEntry.register_regions(
('main', _('Main content area')),
)
Register templates and add a template_key field to the model for saving the selected template:
Page.register_templates({
'key': 'base',
'title': _('Standard template'),
'path': 'feincms_base.html',
'regions': (
('main', _('Main content area')),
('sidebar', _('Sidebar'), 'inherited'),
),
}, {
'key': '2col',
'title': _('Template with two columns'),
'path': 'feincms_2col.html',
'regions': (
('col1', _('Column one')),
('col2', _('Column two')),
('sidebar', _('Sidebar'), 'inherited'),
),
})
A template is a standard Django template which is used to render a CMS object, most commonly a page.
This class represents a region inside a template. Example regions might be ‘main’ and ‘sidebar’.
Returns a list of content types registered for this region as a list of (content type key, beautified content type name) tuples
This proxy offers attribute-style access to the page contents of regions:
>> page = Page.objects.all()[0]
>> page.content.main
[A list of all page contents which are assigned to the region with key 'main']