from django import template
from django.utils.http import urlencode


register = template.Library()


@register.filter
def to_label(value):
    value = value.replace('_', ' ')
    return value.title()

@register.filter
def config_cur(test_name):
    import urllib.parse
    return urllib.parse.quote_plus(f"/API/REST/Test/v1/ConfigCur?sections=all&test_type_name={test_name}&size=0")
