Created
May 3, 2020 22:03
-
-
Save mpampols/019017ed6dbc26fb9cdbb1e4124d0d14 to your computer and use it in GitHub Desktop.
views.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def coverletter_export(request): | |
document = Document() | |
# Get the user's fullname | |
if request.user.get_full_name(): | |
document_data_full_name = request.user.get_full_name() | |
else: | |
document_data_full_name = "[NOMBRE] [APELLIDOS]" | |
# Print the user's name | |
document_elements_heading = document.add_heading(document_data_full_name, 0) | |
document_elements_heading.alignment = WD_ALIGN_PARAGRAPH.CENTER | |
# Add empty paragraph | |
document.add_paragraph() | |
# Print biography and careerpath | |
for line in document_data_biography.splitlines(): | |
if line: | |
document_element_biography = document.add_paragraph(line) | |
document_element_biography.alignment = WD_ALIGN_PARAGRAPH.LEFT | |
document_element_biography.paragraph_format.line_spacing = 1.15 | |
for line in document_data_careerpath.splitlines(): | |
if line: | |
document_element_careerpath = document.add_paragraph(line) | |
document_element_careerpath.alignment = WD_ALIGN_PARAGRAPH.LEFT | |
document_element_careerpath.paragraph_format.line_spacing = 1.15 | |
# Add empty paragraph | |
document.add_paragraph() | |
# Sincerely and name | |
document.add_paragraph("Atentamente,\n" + document_data_full_name) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment