match filter

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import re

from django import template

register = template.Library()

@register.filter
def match(value, regex):
    """Usage: {% if value|match:"regex" %}"""
    return re.match(regex, value)

More like this

  1. location context_processor by gsf0 2 years, 9 months ago
  2. Template tag "ifregex" and "ifnotregex" by arthurfurlan 3 years ago
  3. Single Django App behind multiple Apache Proxies by chadmaine 5 years ago
  4. Url filter middleware by limodou 5 years, 2 months ago
  5. apache authentication via cookies by sean 5 years, 2 months ago

Comments

(Forgotten your password?)