fefa4ka 10 years ago
parent cc09540f0d
commit 8f17ab85de
  1. 5
      promo/cms_plugins.py
  2. 4
      promo/templates/promo/index.html

@ -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]

@ -3,8 +3,8 @@
{% block promo_content %}
{% if instance %}
{% autoescape off %}
{{ instance.text }}
{% endautoescape %}
{% endif %}
{{ history }}
{% endblock %}
Loading…
Cancel
Save