|
|
|
|
@ -16,10 +16,14 @@ class PromoPluginPublisher(CMSPluginBase): |
|
|
|
|
|
|
|
|
|
history = request.session['history'] |
|
|
|
|
|
|
|
|
|
context.update({ |
|
|
|
|
'instance': Promo.objects.filter(page_link_id__in=history).order_by('?')[0], |
|
|
|
|
'history': history |
|
|
|
|
}) |
|
|
|
|
promos = Promo.objects.filter(page_link_id__in=history).order_by('?') |
|
|
|
|
|
|
|
|
|
if promos.exists(): |
|
|
|
|
promo = promos[0] |
|
|
|
|
promo.text = promo.text.replace('#promo', promo.page_link.get_absolute_url()) |
|
|
|
|
context.update({ |
|
|
|
|
'instance': promo, |
|
|
|
|
}) |
|
|
|
|
return context |
|
|
|
|
|
|
|
|
|
plugin_pool.register_plugin(PromoPluginPublisher) # register the plugin |
|
|
|
|
|