1 # Copyright 2012 GRNET S.A. All rights reserved.
3 # Redistribution and use in source and binary forms, with or
4 # without modification, are permitted provided that the following
7 # 1. Redistributions of source code must retain the above
8 # copyright notice, this list of conditions and the following
11 # 2. Redistributions in binary form must reproduce the above
12 # copyright notice, this list of conditions and the following
13 # disclaimer in the documentation and/or other materials
14 # provided with the distribution.
16 # THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17 # OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 # USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 # AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 # POSSIBILITY OF SUCH DAMAGE.
29 # The views and conclusions contained in the software and
30 # documentation are those of the authors and should not be
31 # interpreted as representing official policies, either expressed
32 # or implied, of GRNET S.A.
37 from django import forms
38 from django.db import models
39 from django.utils.text import capfirst
40 from django.utils.translation import ugettext_lazy as _
42 from feincms.module.page.models import Page
43 from feincms.content.raw.models import RawContent
44 from feincms.content.richtext.models import RichTextContent
45 from feincms.content.image.models import ImageContent
46 from feincms.content.application.models import ApplicationContent
47 from feincms.module.page.extensions.navigation import NavigationExtension, \
49 from feincms.content.application.models import reverse
50 from feincms.content.medialibrary.v2 import MediaFileContent
51 from feincms.content.section.models import SectionContent
52 from feincms.content.table.models import TableContent
53 from feincms.content.template.models import TemplateContent
54 from feincms.content.video.models import VideoContent
55 from feincms.content.richtext.models import RichTextContent
57 from cloudcmsresources.models import ResourcesList
58 from cloudcms.content import *
60 Page.register_extensions(
72 # Feincms Page templates declaration
75 'title': 'Basic 2 columns template (left wider)',
76 'path': 'cms/pages/twocolwide.html',
78 ('main', 'Main region'),
79 ('sidebar', 'Sidebar', 'inherited'),
84 'title': 'Basic (Top 1 col, Bottom 2 cols)',
85 'path': 'cms/pages/basic1top2bottom.html',
87 ('top', 'Top region'),
88 ('bottom_left', 'Bottom left region'),
89 ('bottom_right', 'Bottom right region'),
93 'key': 'basic2top2bottom',
94 'title': 'Basic (Top 2 cols, Bottom 2 cols)',
95 'path': 'cms/pages/basic2top2bottom.html',
97 ('top_left', 'Top left region'),
98 ('top_right', 'Top right region'),
99 ('bottom_left', 'Bottom left region'),
100 ('bottom_right', 'Bottom right region'),
105 'title': 'Blog template',
106 'path': 'cms/pages/blog.html',
108 ('main', 'Main region'),
109 ('sidebar', 'Sidebar', 'inherited'),
114 'title': 'Userguide template',
115 'path': 'cms/pages/userguide.html',
117 ('top', 'Top region'),
118 ('bottom_left', 'Bottom left region'),
119 ('bottom_right', 'Bottom right region'),
124 'title': 'FAQ\'s template',
125 'path': 'cms/pages/faq.html',
127 ('top', 'Top region'),
128 ('bottom_left', 'Bottom left region'),
129 ('bottom_right', 'Bottom right region'),
134 'title': 'Empty content template',
135 'path': 'cms/pages/empty.html',
137 ('main', 'Main region'),
143 map(Page.register_templates, TEMPLATES)
145 Page.create_content_type(TextileContent)
146 Page.create_content_type(IntroBlock)
147 Page.create_content_type(RichTextContent)
148 Page.create_content_type(RawContent)
149 Page.create_content_type(SectionContent, TYPE_CHOICES=(('block', 'Block'),))
150 Page.create_content_type(TemplateContent)
151 Page.create_content_type(TwitterFeed)
152 Page.create_content_type(VideoContent)
153 Page.create_content_type(VideoSection)
154 Page.create_content_type(IntroButton)
155 Page.create_content_type(ClientDownload)
156 Page.create_content_type(ImageContent, POSITION_CHOICES=(
157 ('default', 'Default position'),
159 Page.create_content_type(MediaFileContent, TYPE_CHOICES=(
160 ('lightbox', 'lightbox'),
161 ('download', 'as download')
163 Page.create_content_type(ApplicationContent, APPLICATIONS=(
164 ('cloudcmsblog', 'Cloud blog', {'urls': 'cloudcmsblog.urls'}),
165 ('cloudcmsfaq', 'Cloud FAQ', {'urls': 'cloudcmsfaq.urls'}),
166 ('cloudcmsguide', 'Cloud user guide', {'urls': 'cloudcmsguide.urls'}),)
169 # cloudcms specific content registration
170 Page.create_content_type(LoginForm)
171 Page.create_content_type(AboutBlock)
172 Page.create_content_type(ResourcesList)
173 Page.create_content_type(BlockColor)
175 # Extra cms applications
176 EXTRA_CONTENT_MODELS = []
178 if 'cloudcmsblog' in settings.INSTALLED_APPS:
179 from cloudcmsblog.models import Entry, LatestEntries
180 EXTRA_CONTENT_MODELS.append(Entry)
181 Page.create_content_type(LatestEntries)
183 if 'cloudcmsfaq' in settings.INSTALLED_APPS:
184 from cloudcmsfaq.models import Question
185 EXTRA_CONTENT_MODELS.append(Question)
187 if 'cloudcmsguide' in settings.INSTALLED_APPS:
188 from cloudcmsguide.models import UserGuideEntry
189 EXTRA_CONTENT_MODELS.append(UserGuideEntry)
191 for model in EXTRA_CONTENT_MODELS:
192 # Feincms specific registrations for our blog entry model
193 model.register_regions(
194 ('main', _('Main content area')),
195 ('sidebar', _('Right column')),
197 model.create_content_type(RawContent)
198 model.create_content_type(TemplateContent)
199 model.create_content_type(SectionContent, TYPE_CHOICES=(('block', 'Block'),))
200 model.create_content_type(RichTextContent, cleanse=False, regions=('main',))
201 model.create_content_type(ImageContent, POSITION_CHOICES=(
202 ('default', 'Default position'),