add E-Mail support via celery task, untested, closes #17

This commit is contained in:
Jens Langhammer
2019-02-26 14:07:47 +01:00
parent e7fb48eba2
commit ad96f7dbb8
13 changed files with 388 additions and 13 deletions

View File

@ -0,0 +1,20 @@
"""passbook core inlining template tags"""
import os
from django import template
from django.conf import settings
register = template.Library()
@register.simple_tag()
def inline_static(path):
"""Inline static asset. If file is binary, return b64 representation"""
prefix = 'data:image/svg+xml;utf8,'
data = ''
full_path = settings.STATIC_ROOT + '/' + path
if os.path.exists(full_path):
if full_path.endswith('.svg'):
with open(full_path) as _file:
data = _file.read()
return prefix + data