diff --git a/newsbox_cms/cms_plugins.py b/newsbox_cms/cms_plugins.py index e5b2a10a54e3efe90e6987bfbc98827c46b2e830..22e003f28eb8d67a0415b188f9c04c89e140a24d 100644 --- a/newsbox_cms/cms_plugins.py +++ b/newsbox_cms/cms_plugins.py @@ -2,8 +2,6 @@ from __future__ import unicode_literals from django.utils.translation import ugettext as _ -from django.db import models -from django.contrib import admin from cms.plugin_base import CMSPluginBase from newsbox.models import NewsboxBase @@ -17,7 +15,6 @@ class NewsboxPluginBase(CMSPluginBase): return NewsboxModel.objects.published() def render(self, context, instance, placeholder): - from django.db.models.loading import get_model NewsboxModel = instance.newsbox_model @@ -25,7 +22,7 @@ class NewsboxPluginBase(CMSPluginBase): raise Exception(_("The choosen news type to display is invalid")) newsset = self.get_instance_queryset( - instance=instance, + instance=instance, request=context['request']) if instance.numitems > 0 : @@ -56,13 +53,13 @@ class NewsboxPluginBase(CMSPluginBase): 'newsbox_opts':NewsboxModel._newsbox_meta, 'with_pager':with_pager, }) - + if instance.page_link: context.update({ 'title_url' : instance.page_link.get_absolute_url(), 'all_news_url': instance.page_link.get_absolute_url(), }) return context - + class Meta: abstract = True