🏷️(backend) add body type on generate-document endpoint
We were converting from markdown to html, but the frontend can provide the body in html format, so wa can avoid the conversion. Solution: Add body type on generate-document endpoint to allow to choose between markdown and html.
This commit is contained in:
@@ -372,9 +372,10 @@ class TemplateViewSet(
|
||||
)
|
||||
|
||||
body = serializer.validated_data["body"]
|
||||
body_type = serializer.validated_data["body_type"]
|
||||
|
||||
template = self.get_object()
|
||||
pdf_content = template.generate_document(body)
|
||||
pdf_content = template.generate_document(body, body_type)
|
||||
|
||||
response = FileResponse(BytesIO(pdf_content), content_type="application/pdf")
|
||||
response["Content-Disposition"] = f"attachment; filename={template.title}.pdf"
|
||||
|
||||
Reference in New Issue
Block a user