Exemple #1
0
    fa_icon("check", title=_("Agree")),
    "convergence":
    fa_icon(
        "handshake",
        title=
        _("Agreement level\n0%: votes are evenly split\n100%: everyone has the same opinion"
          ),
    ),
    "disagree":
    fa_icon("times", title=_("Disagree")),
    "participation":
    fa_icon("users", title=_("Participation ratio")),
    "skip":
    fa_icon("arrow-right", title=_("Skip")),
    "skipped":
    fa_icon("arrow-right", title=_("Skipped")),
}

PC_COLUMNS = [
    "missing",
    "skipped",
    "agree",
    "disagree",
    "average",
    "convergence",
    "entropy",
    "participation",
]

html.register(type(fa_icon("check")), lambda x, *args: x)
Exemple #2
0
    render_queryset.register = register
    return render_queryset


def render_with_template(func, template):
    """
    Return a render function that renders using a template.

    Args:
        func:
            Function that computes the context dictionary passed to template.
        template:
            Name (or list of names) of the template.
    """
    template = django_loader.get_template(template)
    renderer = template.render

    def wrapped(obj, **kwargs):
        ctx = func(obj, **kwargs)
        request = ctx.get('request')
        data = renderer(context=ctx, request=request)
        return Text(data, escape=False)

    return wrapped


register_queryset = queryset_closure()
html.register(QuerySet)(register_queryset)
html.with_template = with_template
html.register_queryset = register_queryset.register