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