-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathgenerate.py
32 lines (28 loc) · 938 Bytes
/
generate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from jinja2 import Environment, FileSystemLoader
import csv
def _render_template(name, payment_status):
# loading the templates folder
file_loader = FileSystemLoader('templates')
env = Environment(
loader=file_loader,
trim_blocks=True,
lstrip_blocks=True,
keep_trailing_newline=True,
)
# fetching the template from the FileSystemLoader
template = env.get_template('message.txt')
# rendering the template
return template.render(name=name, payment_status=payment_status)
def preprocess(participants):
# converting the list of lists to list of dict
data = []
for participant in participants:
data.append({
"name": participant[0],
"dob": participant[1],
"email": participant[2],
"city": participant[3],
"phone": participant[4],
"payment": participant[5],
})
return data