Export participants to different formats
* CSV * PDF (requires Python dependency `weasyprint`) * ODS (requires Python dependency `pyexcel_ods3`) Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
8
priv/python/module.py
Normal file
8
priv/python/module.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import pkg_resources
|
||||
|
||||
def has_package(package):
|
||||
try:
|
||||
pkg_resources.get_distribution(package.decode('ascii'))
|
||||
return True
|
||||
except pkg_resources.DistributionNotFound:
|
||||
return False
|
||||
12
priv/python/ods.py
Normal file
12
priv/python/ods.py
Normal file
@@ -0,0 +1,12 @@
|
||||
from pyexcel_ods3 import save_data
|
||||
from collections import OrderedDict
|
||||
from io import BytesIO as StringIO
|
||||
import json
|
||||
|
||||
def generate(data):
|
||||
struct = json.loads(data)
|
||||
data = OrderedDict()
|
||||
data.update({"Sheet 1": struct})
|
||||
io = StringIO()
|
||||
save_data(io, data)
|
||||
return io.getvalue()
|
||||
4
priv/python/pdf.py
Normal file
4
priv/python/pdf.py
Normal file
@@ -0,0 +1,4 @@
|
||||
from weasyprint import HTML
|
||||
|
||||
def generate(html):
|
||||
return HTML(string=html.decode('utf-8')).write_pdf()
|
||||
Reference in New Issue
Block a user