Commit bc43f1cb authored by Bryan  BRANCOTTE's avatar Bryan BRANCOTTE

using a small seed to avoid overlap when templates are generated at the same...

using a small seed to avoid overlap when templates are generated at the same second (in tests for example)
parent 264877c3
import csv
import io
import os
import random
import string
import pandas as pd
from basetheme_bootstrap.user_preferences import get_user_preferences_for_user
......@@ -1203,9 +1205,10 @@ class LiveInputVirusHostForm(forms.Form):
legend.append([m.name, m.value])
df_legend = pd.DataFrame(legend_name, columns=[str(_("Recommended responses scheme"))], index=legend_value)
filename = 'Template generated on %(date)s at %(time)s' % dict(
filename = 'Template %(seed)s generated on %(date)s at %(time)s' % dict(
date=timezone.now().strftime('%Y-%m-%d'),
time=timezone.now().strftime('%Hh%Mm%Ss'),
seed="".join([random.choice(string.ascii_letters) for i in range(4)])
)
file_path = os.path.join(settings.MEDIA_ROOT, filename + ".xlsx")
with pd.ExcelWriter(file_path) as writer:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment