f string updates

This commit is contained in:
Mouse Reeve 2021-09-27 10:21:46 -07:00
parent 28d40e9914
commit 69b010a8d3
4 changed files with 6 additions and 3 deletions

View file

@ -31,6 +31,7 @@ class Announcements(View):
"end_date", "end_date",
"active", "active",
] ]
# pylint: disable=consider-using-f-string
if sort in sort_fields + ["-{:s}".format(f) for f in sort_fields]: if sort in sort_fields + ["-{:s}".format(f) for f in sort_fields]:
announcements = announcements.order_by(sort) announcements = announcements.order_by(sort)
data = { data = {

View file

@ -28,6 +28,7 @@ class Federation(View):
sort = request.GET.get("sort") sort = request.GET.get("sort")
sort_fields = ["created_date", "application_type", "server_name"] sort_fields = ["created_date", "application_type", "server_name"]
# pylint: disable=consider-using-f-string
if not sort in sort_fields + ["-{:s}".format(f) for f in sort_fields]: if not sort in sort_fields + ["-{:s}".format(f) for f in sort_fields]:
sort = "-created_date" sort = "-created_date"
servers = servers.order_by(sort) servers = servers.order_by(sort)

View file

@ -41,9 +41,9 @@ def email_preview(request):
"""for development, renders and example email template""" """for development, renders and example email template"""
template = request.GET.get("email") template = request.GET.get("email")
data = emailing.email_data() data = emailing.email_data()
data["subject_path"] = "email/{}/subject.html".format(template) data["subject_path"] = f"email/{template}/subject.html"
data["html_content_path"] = "email/{}/html_content.html".format(template) data["html_content_path"] = f"email/{template}/html_content.html"
data["text_content_path"] = "email/{}/text_content.html".format(template) data["text_content_path"] = f"email/{template}/text_content.html"
data["reset_link"] = "https://example.com/link" data["reset_link"] = "https://example.com/link"
data["invite_link"] = "https://example.com/link" data["invite_link"] = "https://example.com/link"
data["confirmation_link"] = "https://example.com/link" data["confirmation_link"] = "https://example.com/link"

View file

@ -47,6 +47,7 @@ class UserAdminList(View):
"federated_server__server_name", "federated_server__server_name",
"is_active", "is_active",
] ]
# pylint: disable=consider-using-f-string
if sort in sort_fields + ["-{:s}".format(f) for f in sort_fields]: if sort in sort_fields + ["-{:s}".format(f) for f in sort_fields]:
users = users.order_by(sort) users = users.order_by(sort)