@register.filter
@stringfilter
def fref(number, length):
    ref = group_right(number)
    if len(ref) >= length:
        return ref
    else:
        ret = u""
        for i in xrange(0, int(length) - len(ref)):
            ret = ret + u"&nbsp;"
        return mark_safe(ret + ref)
Number is the reference number, length is the max reference number length anticipated.
dataset/ETHPy150Open kapsiry/sikteeri/membership/templatetags/reference_number.py/fref