Changed to using a template to generate bluesheets and added a count of participants at the top.

- Legacy-Id: 18344
This commit is contained in:
Henrik Levkowetz 2020-08-07 09:58:46 +00:00
parent fa49790bbe
commit fcfc22bafd
2 changed files with 13 additions and 3 deletions

View file

@ -3098,12 +3098,15 @@ def api_upload_bluesheet(request):
except json.decoder.JSONDecodeError:
return err(400, "Invalid json value: '%s'" % (bjson, ))
text = render_to_string('meeting/bluesheet.txt', {
'data': data,
'session': session,
})
fd, name = tempfile.mkstemp(suffix=".txt", text=True)
os.close(fd)
with open(name, "w") as file:
file.write("Bluesheets for %s\n\n" % session)
for item in data:
file.write("{name}\t{affiliation}\n".format(**item))
file.write(text)
with open(name, "br") as file:
save_err = save_bluesheet(request, session, file)
if save_err:

View file

@ -0,0 +1,7 @@
Bluesheet for {{session}}
========================================================================
{{ data|length }} attendees.
{% for item in data %}
{{ item.name }} {{ item.affiliation }}{% endfor %}