Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
refactor: replace percent format with fstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
c0rydoras committed Apr 29, 2024
1 parent 70d29c0 commit 9c16448
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion timed/employment/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def filter(self, qs: T, value: int) -> T:
if value in EMPTY_VALUES:
return qs

return qs.filter(**{"%s__year" % self.field_name: value})
return qs.filter(**{f"{self.field_name}__year": value})


class PublicHolidayFilterSet(FilterSet):
Expand Down
6 changes: 3 additions & 3 deletions timed/reports/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def list(self, request, *args, **kwargs):
doc.tobytes(),
content_type="application/vnd.oasis.opendocument.spreadsheet",
)
response["Content-Disposition"] = "attachment; filename=%s" % name
response["Content-Disposition"] = f"attachment; filename={name}"
return response

# zip multiple work reports
Expand All @@ -450,7 +450,7 @@ def list(self, request, *args, **kwargs):
for name, doc in docs:
zf.writestr(name, doc.tobytes())
response = HttpResponse(buf.getvalue(), content_type="application/zip")
response["Content-Disposition"] = "attachment; filename=%s-WorkReports.zip" % (
date.today().strftime("%Y%m%d")
response["Content-Disposition"] = (
f"attachment; filename={date.today():%Y%m%d}-WorkReports.zip"
)
return response
2 changes: 1 addition & 1 deletion timed/tracking/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ def export(self, request):

sheet = django_excel.pe.Sheet(content, name="Report", colnames=colnames)
return django_excel.make_response(
sheet, file_type=file_type, file_name="report.%s" % file_type
sheet, file_type=file_type, file_name=f"report.{file_type}"
)


Expand Down

0 comments on commit 9c16448

Please sign in to comment.