Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Page.create_content_type(
ApplicationContent,
APPLICATIONS=(
(
"whatever",
"Test Urls",
{
"admin_fields": get_admin_fields,
"urls": "testapp.applicationcontent_urls",
},
),
),
)
Page.register_extensions(
"feincms.module.page.extensions.navigation",
"feincms.module.page.extensions.sites",
"feincms.extensions.translations",
"feincms.extensions.datepublisher",
"feincms.extensions.translations",
"feincms.extensions.ct_tracker",
"feincms.extensions.seo",
"feincms.extensions.changedate",
"feincms.extensions.seo", # duplicate
"feincms.module.page.extensions.navigation",
"feincms.module.page.extensions.symlinks",
"feincms.module.page.extensions.titles",
"feincms.module.page.extensions.navigationgroups",
)
self.assertRaises(NotImplementedError, lambda: obj.render())
obj.region = 'region'
self.assertEqual(obj.render(), 'hello')
class PassthroughExtension(NavigationExtension):
# See PagesTestCase.test_23_navigation_extension
name = 'passthrough extension'
def children(self, page):
for p in page.children.in_navigation():
yield p
Page.register_extensions('datepublisher', 'navigation', 'seo', 'symlinks',
'titles', 'translations', 'seo')
Page.create_content_type(ContactFormContent, form=ContactForm)
Page.create_content_type(FileContent)
class PagesTestCase(TestCase):
def setUp(self):
u = User(username='test', is_active=True, is_staff=True, is_superuser=True)
u.set_password('test')
u.save()
Page.register_templates({
'key': 'base',
'title': 'Standard template',
'path': 'feincms_base.html',
'regions': (
Page.register_templates({
'title': 'Standard template',
'path': 'feincms_base.html',
'regions': (
('main', _('Main content area')),
),
}, {
'title': 'With moodboard',
'path': 'feincms_moodboard.html',
'regions': (
('main', _('Main content area')),
('moodboard', _('Moodboard'), 'inherited'),
),
})
Page.register_extensions(
'feincms.module.page.extensions.titles',
'feincms.module.page.extensions.navigation',
'feincms.module.extensions.seo',
'feincms.module.extensions.changedate',
'feincms.module.extensions.ct_tracker',
)
Page.create_content_type(ApplicationContent, APPLICATIONS=(
('zipfelchappe.urls', _('Zipfelchappe projects')),
))
Page.create_content_type(RichTextContent)
Page.create_content_type(MediaFileContent, TYPE_CHOICES=MEDIA_TYPE_CHOICES)
Page.create_content_type(ProjectTeaserContent)
Page.create_content_type(RawContent)
#-*- coding:utf-8 -*-
from feincms.module.page.models import Page
from feincms.content.richtext.models import RichTextContent
from south.modelsinspector import add_introspection_rules
add_introspection_rules([], ["^ckeditor\.fields\.RichTextField"])
Page.register_extensions('nscms.portal.page.extensions.tags',
'datepublisher',
'changedate',
'seo')
Page.create_content_type(RichTextContent)
It would be added to 'Blog' page properties in admin.
"""
name = _('all blog entries')
def children(self, page, **kwargs):
for entry in Entry.objects.all():
yield PagePretender(
title=entry.title,
url=reverse('blog_urls/blog_entry_details', kwargs={'object_id': entry.id}),
level=kwargs['level'],
# NOTE: this is hack, just to make tree_info happy
tree_id=0, lft=0, rght=0
)
Page.register_extensions('navigation', 'feincmsext.extended_navigation.extensions.navigation_type')
Extended navigation for blog entries.
It would be added to 'Blog' page properties in admin.
"""
name = _('all blog entries')
def children(self, page, **kwargs):
for entry in Entry.objects.all():
yield PagePretender(
title=entry.title,
url=app_reverse(
'blog_entry_detail', 'blog_urls', kwargs={'pk': entry.id}),
level=page.level + 1,
)
Page.register_extensions(
'feincms.module.page.extensions.navigation',
'feincms.module.page.extensions.sites',
)
@python_2_unicode_compatible
class Category(MPTTModel):
name = models.CharField(max_length=20)
slug = models.SlugField()
parent = models.ForeignKey(
'self', blank=True, null=True, related_name='children')
class Meta:
ordering = ['tree_id', 'lft']
verbose_name = 'category'
verbose_name_plural = 'categories'
from django.utils.translation import ugettext_lazy as _
from feincms.content.raw.models import RawContent
from feincms.content.richtext.models import RichTextContent
from feincms.module.page.models import Page
# Import the ``django-fobi`` widget.
from fobi.contrib.apps.feincms_integration.widgets import FobiFormWidget
Page.register_extensions('feincms.module.extensions.translations',)
# Register basic template.
Page.register_templates(
{
'title': _(u"Base template"),
'path': 'page/base.html',
'key': 'page_base',
'regions': (
('main', _(u"Main")),
('sidebar', _(u"Sidebar")),
)
},
)
# Standard content types
Page.create_content_type(RawContent)