mirror of
https://github.com/th3r00t/pyShelf.git
synced 2026-04-28 01:59:35 -04:00
Custom template filter bin_2_img
This commit is contained in:
@@ -38,6 +38,7 @@ INSTALLED_APPS = [
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'interface',
|
||||
'interface.templatetags'
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
||||
0
frontend/interface/templatetags/__init__.py
Normal file
0
frontend/interface/templatetags/__init__.py
Normal file
10
frontend/interface/templatetags/filters.py
Normal file
10
frontend/interface/templatetags/filters.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from base64 import b64encode
|
||||
|
||||
from django import template
|
||||
|
||||
register = template.Library()
|
||||
|
||||
|
||||
@register.filter
|
||||
def bin_2_img(_bin):
|
||||
if _bin is not None: return b64encode(_bin)
|
||||
Reference in New Issue
Block a user