Skip to content

Commit bab45d0

Browse files
committed
Updated for v1.4
1 parent 2188589 commit bab45d0

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

logic.py

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
from bs4 import BeautifulSoup
77

88
from django.template.loader import render_to_string
9-
9+
from django.utils import translation
10+
from django.conf import settings
1011

1112
from core import files, models as core_models
1213

@@ -27,6 +28,7 @@ def html_table_to_csv(html):
2728
f.close()
2829
return filepath
2930

31+
3032
def export_csv(request, article, article_files):
3133
elements = [
3234
'general.html',
@@ -71,20 +73,21 @@ def export_csv(request, article, article_files):
7173

7274

7375
def export_html(request, article, article_files):
74-
html_file_path = files.create_temp_file(
75-
render_to_string(
76-
'export/export.html',
77-
context = {
78-
'article': article,
79-
'journal': request.journal,
80-
'files': article_files,
81-
}
82-
),
83-
'{code}-{pk}.html'.format(
84-
code=article.journal.code,
85-
pk=article.pk,
76+
with translation.override(settings.LANGUAGE_CODE):
77+
html_file_path = files.create_temp_file(
78+
render_to_string(
79+
'export/export.html',
80+
context={
81+
'article': article,
82+
'journal': request.journal,
83+
'files': article_files,
84+
}
85+
),
86+
'{code}-{pk}.html'.format(
87+
code=article.journal.code,
88+
pk=article.pk,
89+
)
8690
)
87-
)
8891

8992
zip_file_name = 'export_{}_{}_html.zip'.format(article.journal.code, article.pk)
9093
zip_path = os.path.join(files.TEMP_DIR, zip_file_name)

0 commit comments

Comments
 (0)