Filter to generate QR codes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
from django import template

register = template.Library()

@register.filter
def qr(value,size="150x150"):
    """
        Usage:
        <img src="{{object.code|qr:"120x130"}}" />
    """
    return "http://chart.apis.google.com/chart?chs=%s&cht=qr&chl=%s&choe=UTF-8&chld=H|0" % (size, value)

More like this

  1. Simple "html email with images" sender by andres_torres_marroquin 3 years, 1 month ago
  2. E-mail quoting filters and tags by ChipX86 6 years, 10 months ago
  3. [UPDATE]Filter to resize a ImageField on demand by rafacdb 5 years, 8 months ago
  4. Wiki-like markup for sub templates by luckystarr 6 years, 7 months ago
  5. Type checking templatetag filters by marcorogers 4 years, 1 month ago

Comments

(Forgotten your password?)