diff --git a/promo/cms_plugins.py b/promo/cms_plugins.py index 77ed74d..45c09bd 100644 --- a/promo/cms_plugins.py +++ b/promo/cms_plugins.py @@ -4,6 +4,7 @@ from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool from django.utils.translation import ugettext as _ from .models import Promo +from django.db.models import Q class PromoPluginPublisher(CMSPluginBase): # model = PollPluginModel # model where plugin data are saved @@ -16,9 +17,7 @@ class PromoPluginPublisher(CMSPluginBase): history = request.session['history'] - promos = Promo.objects.filter(page_link_id__in=history).order_by('?') - - context.update({'history': history}) + promos = Promo.objects.filter(Q(page_link_id__in=history) | Q(page_link__publisher_public_id__in=history)).order_by('?') if promos.exists(): promo = promos[0] diff --git a/promo/templates/promo/index.html b/promo/templates/promo/index.html index 884f39b..a46d118 100644 --- a/promo/templates/promo/index.html +++ b/promo/templates/promo/index.html @@ -3,8 +3,8 @@ {% block promo_content %} {% if instance %} +{% autoescape off %} {{ instance.text }} - +{% endautoescape %} {% endif %} -{{ history }} {% endblock %} \ No newline at end of file