Skip to content

Commit 9d8a90e

Browse files
committed
Use options to capture desired document
1 parent 1101576 commit 9d8a90e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

nofos/composer/views.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1796,7 +1796,10 @@ def _handle_download_request(self, document, request):
17961796
export_url = request.build_absolute_uri(
17971797
reverse("composer:writer_instance_export", args=[document.pk])
17981798
)
1799-
grabzit.URLToDOCX(export_url)
1799+
options = GrabzItDOCXOptions.GrabzItDOCXOptions()
1800+
options.targetElement = "#download_target"
1801+
grabzit.URLToDOCX(export_url, options)
1802+
18001803
filePath = f"/tmp/{document.pk}.docx"
18011804
grabzit.SaveTo(filePath)
18021805

@@ -1928,5 +1931,7 @@ def get_context_data(self, **kwargs):
19281931
context = super().get_context_data(**kwargs)
19291932
# attached sections and subsections for rendering
19301933
context["sections"] = self.get_ordered_sections()
1934+
# Add prefix for anchor links
1935+
context["url_prefix"] = "grabzitlink://"
19311936

19321937
return context

0 commit comments

Comments
 (0)