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, 5 months ago
  2. Template tag "ifregex" and "ifnotregex" by arthurfurlan 2 years, 8 months ago
  3. Single Django App behind multiple Apache Proxies by chadmaine 4 years, 9 months ago
  4. Url filter middleware by limodou 4 years, 11 months ago
  5. ImageMagick commands from Django Templates by cogat 2 years, 9 months ago

Comments

(Forgotten your password?)