def setUp(self): u = User(username="******", is_active=True, is_staff=True, is_superuser=True) u.set_password("test") u.save() Entry.register_regions(("main", "Main region"), ("another", "Another region")) Entry.prefilled_categories = prefilled_attribute("categories") Entry.prefilled_rawcontent_set = prefilled_attribute("rawcontent_set")
def setUp(self): u = User(username='******', is_active=True, is_staff=True, is_superuser=True) u.set_password('test') u.save() Entry.register_regions(('main', 'Main region'), ('another', 'Another region')) Entry.prefilled_categories = prefilled_attribute('categories') Entry.prefilled_rawcontent_set = prefilled_attribute('rawcontent_set')
def setUp(self): u = User(username='******', is_active=True, is_staff=True, is_superuser=True) u.set_password('test') u.save() Entry.register_regions(('main', 'Main region'), ('another', 'Another region'))
def ready(self): from feincms.module.blog.models import Entry from feincms.module.page.models import Page from feincms.content.raw.models import RawContent from feincms.content.image.models import ImageContent from feincms.content.medialibrary.models import MediaFileContent from feincms.content.application.models import ApplicationContent from .models import get_admin_fields Page.create_content_type(RawContent) Page.create_content_type( MediaFileContent, TYPE_CHOICES=(('default', 'Default position'), ), ) Page.create_content_type( ImageContent, POSITION_CHOICES=(('default', 'Default position'), ), ) Page.create_content_type(ApplicationContent, APPLICATIONS=(('blog_urls', 'Blog', { 'admin_fields': get_admin_fields, 'urls': 'example.blog_urls', }), )) Entry.register_regions(('main', 'Main region'), ) Entry.create_content_type(RawContent) Entry.create_content_type(ImageContent, POSITION_CHOICES=(('default', 'Default position'), ))
page_de_1.applicationcontent_set.create( region='main', ordering=0, urlconf_path='feincms.tests.applicationcontent_urls') _empty_reverse_cache() settings.TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__), 'templates'),) self.client.get(page_de.get_absolute_url()) self.assertEqual(reverse('feincms.tests.applicationcontent_urls/ac_module_root'), page_de_1.get_absolute_url()) self.client.get(page1.get_absolute_url()) self.assertEqual(reverse('feincms.tests.applicationcontent_urls/ac_module_root'), page.get_absolute_url()) Entry.register_extensions('seo', 'translations', 'seo') class BlogTestCase(TestCase): def setUp(self): u = User(username='******', is_active=True, is_staff=True, is_superuser=True) u.set_password('test') u.save() Entry.register_regions(('main', 'Main region'), ('another', 'Another region')) Entry.prefilled_categories = prefilled_attribute('categories') Entry.prefilled_rawcontent_set = prefilled_attribute('rawcontent_set') def login(self): self.assertTrue(self.client.login(username='******', password='******')) def create_entry(self): entry = Entry.objects.create(
self.assertEqual(u"".join(c.render() for c in page.content.main), "somethinggg") def test_28_cached_url_clash(self): self.create_default_page_set() page1 = Page.objects.get(pk=1) page2 = Page.objects.get(pk=2) page1.override_url = "/" page1.active = True page1.save() self.assertContains(self.create_pagecontent(page2, active=True, override_url="/"), "already taken by") Entry.register_extensions("seo", "translations", "seo") class BlogTestCase(TestCase): def setUp(self): u = User(username="******", is_active=True, is_staff=True, is_superuser=True) u.set_password("test") u.save() Entry.register_regions(("main", "Main region"), ("another", "Another region")) Entry.prefilled_categories = prefilled_attribute("categories") Entry.prefilled_rawcontent_set = prefilled_attribute("rawcontent_set") def login(self): assert self.client.login(username="******", password="******")
label=capfirst(_('exclusive subpages')), required=False, initial=form.instance.parameters.get('exclusive_subpages', False), help_text=_('Exclude everything other than the application\'s content when rendering subpages.'), ), } Page.create_content_type(ApplicationContent, APPLICATIONS=( ('testapp.blog_urls', 'Blog', {'admin_fields': get_admin_fields}), ('whatever', 'Test Urls', {'urls': 'testapp.applicationcontent_urls'}), )) Entry.register_extensions( 'feincms.module.extensions.seo', 'feincms.module.extensions.translations', 'feincms.module.extensions.seo', 'feincms.module.extensions.ct_tracker', ) Entry.register_regions( ('main', 'Main region'), ) Entry.create_content_type(RawContent) Entry.create_content_type(ImageContent, POSITION_CHOICES=( ('default', 'Default position'), )) class BlogEntriesNavigationExtension(NavigationExtension): """ Extended navigation for blog entries.
'feincms.module.extensions.changedate', 'feincms.module.extensions.seo', # duplicate 'feincms.module.page.extensions.navigation', 'feincms.module.page.extensions.symlinks', 'feincms.module.page.extensions.titles', ) Page.create_content_type(ContactFormContent, form=ContactForm) Page.create_content_type(FileContent) Page.register_request_processor(processors.etag_request_processor) Page.register_response_processor(processors.etag_response_processor) Page.register_response_processor( processors.debug_sql_queries_response_processor()) Entry.register_extensions( 'feincms.module.extensions.seo', 'feincms.module.extensions.translations', 'feincms.module.extensions.seo', 'feincms.module.extensions.ct_tracker', ) class BlogTestCase(TestCase): def setUp(self): u = User(username='******', is_active=True, is_staff=True, is_superuser=True) u.set_password('test') u.save() Entry.register_regions(('main', 'Main region'), ('another', 'Another region'))
'feincms.module.extensions.changedate', 'feincms.module.extensions.seo', # duplicate 'feincms.module.page.extensions.navigation', 'feincms.module.page.extensions.symlinks', 'feincms.module.page.extensions.titles', ) Page.create_content_type(ContactFormContent, form=ContactForm) Page.create_content_type(FileContent) Page.register_request_processor(processors.etag_request_processor) Page.register_response_processor(processors.etag_response_processor) Page.register_response_processor(processors.debug_sql_queries_response_processor()) Entry.register_extensions( 'feincms.module.extensions.seo', 'feincms.module.extensions.translations', 'feincms.module.extensions.seo', 'feincms.module.extensions.ct_tracker', ) class BlogTestCase(TestCase): def setUp(self): u = User(username='******', is_active=True, is_staff=True, is_superuser=True) u.set_password('test') u.save() Entry.register_regions(('main', 'Main region'), ('another', 'Another region')) def login(self): self.assertTrue(self.client.login(username='******', password='******')) def create_entry(self): entry = Entry.objects.create(
'regions': ( ('main', _('Main content area')), ('sidebar', _('Sidebar'), 'inherited'), ), }) Page.create_content_type(RichTextContent) Page.create_content_type(ImageContent, POSITION_CHOICES=( ('block', _('block')), ('left', _('left')), ('right', _('right')), )) # feincms blog stuff Entry.register_extensions('translations') # Example set of extensions Entry.register_templates({ 'title': _('Standard template'), 'path': 'base.html', 'regions': ( ('main', _('Main content area')), ), }) Entry.create_content_type(RichTextContent) Entry.create_content_type(ImageContent, POSITION_CHOICES=( ('block', _('block')), ('left', _('left')), ('right', _('right')), ))
return { 'exclusive_subpages': forms.BooleanField( label=capfirst(_('exclusive subpages')), required=False, initial=form.instance.parameters.get('exclusive_subpages', False), help_text=_('Exclude everything other than the application\'s content when rendering subpages.'), ), } Page.create_content_type(ApplicationContent, APPLICATIONS=( ('blog_urls', 'Blog', {'admin_fields': get_admin_fields}), )) Entry.register_regions( ('main', 'Main region'), ) Entry.create_content_type(RawContent) Entry.create_content_type(ImageContent, POSITION_CHOICES=( ('default', 'Default position'), )) class BlogEntriesNavigationExtension(NavigationExtension): """ Extended navigation for blog entries. It would be added to 'Blog' page properties in admin. """ name = _('all blog entries')
_empty_reverse_cache() settings.TEMPLATE_DIRS = (os.path.join(os.path.dirname(__file__), 'templates'), ) self.client.get(page_de.get_absolute_url()) self.assertEqual( reverse('feincms.tests.applicationcontent_urls/ac_module_root'), page_de_1.get_absolute_url()) self.client.get(page1.get_absolute_url()) self.assertEqual( reverse('feincms.tests.applicationcontent_urls/ac_module_root'), page.get_absolute_url()) Entry.register_extensions('seo', 'translations', 'seo') class BlogTestCase(TestCase): def setUp(self): u = User(username='******', is_active=True, is_staff=True, is_superuser=True) u.set_password('test') u.save() Entry.register_regions(('main', 'Main region'), ('another', 'Another region')) Entry.prefilled_categories = prefilled_attribute('categories') Entry.prefilled_rawcontent_set = prefilled_attribute('rawcontent_set')
Page.create_content_type( ApplicationContent, APPLICATIONS=( ("blog_urls", "Blog", {"admin_fields": get_admin_fields}), ("news.urls", "News Application"), ("articles.urls", "Articles Application"), ("players.urls", "Players"), ("schedule.urls", "Calendar"), ("gallery.urls", "Gallery New"), ), ) Entry.register_regions(("main", "Main region")) Entry.create_content_type(RawContent, regions=("")) Entry.create_content_type(ImageContent, POSITION_CHOICES=(("default", "Default position"),)) Page.register_extensions("feincms.module.page.extensions.navigation", "feincms.module.page.extensions.sites") 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"
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' def __str__(self): return self.name # add m2m field to entry so it shows up in entry admin Entry.add_to_class('categories', models.ManyToManyField(Category, blank=True, null=True)) EntryAdmin.list_filter += ('categories', )
' when rendering subpages.'), ), 'custom_field': forms.CharField(), } Page.create_content_type( ApplicationContent, APPLICATIONS=( ('testapp.blog_urls', 'Blog', {'admin_fields': get_admin_fields}), ('whatever', 'Test Urls', {'urls': 'testapp.applicationcontent_urls'}), ) ) Entry.register_extensions( 'feincms.module.extensions.seo', 'feincms.module.extensions.translations', 'feincms.module.extensions.seo', 'feincms.module.extensions.ct_tracker', ) Entry.register_regions( ('main', 'Main region'), ) Entry.create_content_type(RawContent) Entry.create_content_type( ImageContent, POSITION_CHOICES=( ('default', 'Default position'), ) ) class BlogEntriesNavigationExtension(NavigationExtension): """
('main', 'Main region'), ('sidebar', 'Sidebar', 'inherited'), ), }) Page.create_content_type(RawContent) MediaFileContent.default_create_content_type(Page) Page.create_content_type(ImageContent, POSITION_CHOICES=( ('default', 'Default position'), )) Page.create_content_type(ApplicationContent, APPLICATIONS=( ('blog_urls', 'Blog'), )) Entry.register_regions( ('main', 'Main region'), ) Entry.create_content_type(RawContent) Entry.create_content_type(ImageContent, POSITION_CHOICES=( ('default', 'Default position'), )) class BlogEntriesNavigationExtension(NavigationExtension): """ Extended navigation for blog entries. It would be added to 'Blog' page properties in admin. """ name = _('all blog entries')