Skip to content

Commit

Permalink
Continued conversion to f-strings from .format for speed and readabil…
Browse files Browse the repository at this point in the history
…ity.
  • Loading branch information
FlipperPA committed Sep 30, 2022
1 parent 7e8468f commit f676ddf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drf_excel/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ def render(self, data, accepted_media_type=None, renderer_context=None):
last_col_letter = "G"
if column_count:
last_col_letter = get_column_letter(column_count)
self.ws.merge_cells("A1:{}1".format(last_col_letter))
self.ws.merge_cells(f"A1:{last_col_letter}1")

cell = self.ws.cell(row=1, column=1, value=header_title)
set_cell_style(cell, header_style)
Expand Down Expand Up @@ -322,7 +322,7 @@ def _make_body(self, body, row, row_count):
if "row_color" in row:
last_letter = get_column_letter(column_count)
cell_range = self.ws[
"A{}".format(row_count) : "{}{}".format(last_letter, row_count)
f"A{row_count}" : f"{last_letter}{row_count}"
]
fill = PatternFill(fill_type="solid", start_color=row["row_color"])
for r in cell_range:
Expand Down

0 comments on commit f676ddf

Please sign in to comment.