How to use the feincms.module.blog.models.Entry function in FeinCMS

To help you get started, we’ve selected a few FeinCMS examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github matthiask / django-content-editor / feincms / tests.py View on Github external
def test_01_prefilled_attributes(self):
        self.create_entry()

        objects = prefill_entry_list(Entry.objects.published(), 'rawcontent_set', 'categories')

        self.assertEqual(len(objects[0]._prefill_categories), 0)
        self.assertEqual(len(objects[0]._prefill_rawcontent_set), 1)
        self.assertEqual(unicode(objects[0]), 'Something')

        objects = Entry.objects.published()

        self.assertEqual(len(objects[0].prefilled_categories), 0)
        self.assertEqual(len(objects[0].prefilled_rawcontent_set), 1)

        objects = prefill_entry_list(Entry.objects.published(), 'rawcontent_set', 'categories', region='another')

        self.assertEqual(len(objects[0]._prefill_categories), 0)
        self.assertEqual(len(objects[0]._prefill_rawcontent_set), 0)

        self.login()
github matthiask / django-content-editor / feincms / tests.py View on Github external
def test_24_admin_redirects(self):
        self.create_default_page_set()
        page = Page.objects.get(pk=1)

        response = self.create_pagecontent(page, _continue=1)
        self.assertRedirects(response, '/admin/page/page/1/')

        response = self.create_pagecontent(page, _addanother=1)
        self.assertRedirects(response, '/admin/page/page/add/')

        response = self.create_pagecontent(page)
        self.assertRedirects(response, '/admin/page/page/')


Entry.register_extensions('seo', 'translations', 'seo')
class BlogTestCase(TestCase):
    def setUp(self):
        u = User(username='test', 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='test', password='test')

    def create_entry(self):
        entry = Entry.objects.create(
            published=True,
github feincms / feincms / feincms / tests.py View on Github external
def test_01_prefilled_attributes(self):
        self.create_entry()

        objects = prefill_entry_list(Entry.objects.published(), 'rawcontent_set', 'categories')

        self.assertEqual(len(objects[0]._prefill_categories), 0)
        self.assertEqual(len(objects[0]._prefill_rawcontent_set), 1)
        self.assertEqual(unicode(objects[0]), 'Something')

        objects = Entry.objects.published()

        self.assertEqual(len(objects[0].prefilled_categories), 0)
        self.assertEqual(len(objects[0].prefilled_rawcontent_set), 1)

        objects = prefill_entry_list(Entry.objects.published(), 'rawcontent_set', 'categories', region='another')

        self.assertEqual(len(objects[0]._prefill_categories), 0)
        self.assertEqual(len(objects[0]._prefill_rawcontent_set), 0)

        self.login()
github feincms / feincms / example / models.py View on Github external
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,
        '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'),
    )
)


class BlogEntriesNavigationExtension(NavigationExtension):
    """
    Extended navigation for blog entries.

    It would be added to 'Blog' page properties in admin.
github matthiask / django-content-editor / example / blog_urls.py View on Github external
from django.conf.urls import patterns, url
from django.views import generic

from feincms.module.blog.models import Entry


urlpatterns = patterns(
    '',
    url(r'^(?P\d+)/', generic.DetailView.as_view(
        queryset=Entry.objects.all(),
        ), name='blog_entry_detail'),
    url(r'^$', generic.ListView.as_view(
        queryset=Entry.objects.all(),
        ), name='blog_entry_list'),
)
github feincms / feincms / example / blog_urls.py View on Github external
from django.conf.urls import patterns, url
from django.views import generic

from feincms.module.blog.models import Entry


urlpatterns = patterns(
    '',
    url(r'^(?P\d+)/', generic.DetailView.as_view(
        queryset=Entry.objects.all(),
        ), name='blog_entry_detail'),
    url(r'^$', generic.ListView.as_view(
        queryset=Entry.objects.all(),
        ), name='blog_entry_list'),
)