<commit_before>from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.models.pluginmodel import CMSPlugin
from django.utils.translation import ugettext_lazy as _
from cms.models import Page
from arividam.utils import get_page_by_slug

import logging

logger = logging.getLogger(__name__)

class NotificationsPlugin(CMSPluginBase):
    model = CMSPlugin
    name = _("Notifications List")
    render_template = "djangocms_notifications/plugin.html"
    cache = False

    def render(self, context, instance, placeholder):
        notifications = get_page_by_slug('notifications')
        context.update({ 'notifications': notifications.children.order_by('-publication_date')[:10] })
        return context

class MarqueePlugin(CMSPluginBase):
    model = CMSPlugin
    name = _("Notifications Marquee")
    render_template = "djangocms_notifications/marquee.html"
    cache = True

    def render(self, context, instance, placeholder):
        notifications = get_page_by_slug("notifications")
        context.update({ "notifications": notifications.children.order_by('-publication_date')[:10] })
        return context

plugin_pool.register_plugin(NotificationsPlugin)
plugin_pool.register_plugin(MarqueePlugin)<commit_msg>fixed #30<commit_after>from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool
from cms.models.pluginmodel import CMSPlugin
from django.utils.translation import ugettext_lazy as _
from cms.models import Page
from arividam.utils import get_page_by_slug

import logging

logger = logging.getLogger(__name__)

class NotificationsPlugin(CMSPluginBase):
    model = CMSPlugin
    name = _("Notifications List")
    render_template = "djangocms_notifications/plugin.html"
    cache = False

    def render(self, context, instance, placeholder):
        notifications = get_page_by_slug('notifications')
        if notifications:
            context.update({ 'notifications': notifications.children.order_by('-publication_date')[:10] })
        return context

class MarqueePlugin(CMSPluginBase):
    model = CMSPlugin
    name = _("Notifications Marquee")
    render_template = "djangocms_notifications/marquee.html"
    cache = True

    def render(self, context, instance, placeholder):
        notifications = get_page_by_slug("notifications")
        if notifications:
            context.update({ "notifications": notifications.children.order_by('-publication_date')[:10] })
        return context

plugin_pool.register_plugin(NotificationsPlugin)
plugin_pool.register_plugin(MarqueePlugin)
{'fraction_non_alphanumeric': 0.08585858585858586, 'fraction_numerical': 0.003885003885003885, 'mean_word_length': 4.773542600896861, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4547180', 'n_tokens_mistral': 746, 'n_tokens_neox': 719, 'n_words': 158}