# coding=utf-8 __author__ = 'marcos.medeiros' from django import template from django.template import loader, Context import random from django.utils.safestring import mark_safe register = template.Library() _templates_path = 'rapid/basics/' @register.simple_tag def show_action(entry, url): action = entry.action if action.pick_generator: t = loader.get_template(_templates_path+'pick_action.html') c = Context({ 'options': url, 'action': action, 'entry': entry, }) return mark_safe(t.render(c)) else: t = loader.get_template(_templates_path+'btn_action.html') c = Context({ 'link': url, 'action': action, 'entry': entry, }) return mark_safe(t.render(c))