Beispiel #1
0
    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'), ))
Beispiel #2
0
    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')
Beispiel #3
0
    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")
Beispiel #4
0
    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'))
Beispiel #5
0
    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')
Beispiel #6
0
    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'))
Beispiel #7
0
    }


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.

    It would be added to 'Blog' page properties in admin.
    """
    name = _('all blog entries')
Beispiel #8
0
    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')
Beispiel #9
0

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"