@@ -0,0 +1,857 @@
+from django import template%0Afrom django.utils.safestring import mark_safe%0Afrom django.utils.translation import ugettext as _%0Aimport hashlib%0A%0Aregister = template.Library()%0A%0A@register.filter%0Adef device_icon(device,size=16):%0A    if device.type == 'desktop':%0A        s = '%3Cimg src=%22/media/%25sx%25s/computer.png%22 alt=%22%25s%22 /%3E' %25 (size, size, _('Desktop'))%0A    elif device.type == 'laptop':%0A        s = '%3Cimg src=%22/media/%25sx%25s/pda.png%22 alt=%22%25s%22 /%3E' %25 (size, size, _('Laptop'))%0A    elif device.type == 'mobile':%0A        s = '%3Cimg src=%22/media/%25sx%25s/multimedia-player.png%22 alt=%22%25s%22 /%3E' %25 (size, size, _('Mobile'))%0A    elif device.type == 'server':%0A        s = '%3Cimg src=%22/media/%25sx%25s/server.png%22 alt=%22%25s%22 /%3E' %25 (size, size, _('Server'))%0A    else:%0A        s = '%3Cimg src=%22/media/%25sx%25s/audio-x-generic.png%22 alt=%22%25s%22 /%3E' %25 (size, size, _('Other'))%0A%0A    return mark_safe(s)%0A%0A

add template filter devices.device_icon