Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ python-semantic-release = "^8.7.0"
[tool.ruff]
fix = true
line-length = 88

[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
Expand Down
2 changes: 1 addition & 1 deletion src/unfold/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def _filter_unfold_actions_by_permissions(
filtered_actions.append(action)
continue
permission_checks = (
getattr(self, "has_%s_permission" % permission)
getattr(self, f"has_{permission}_permission")
for permission in action.method.allowed_permissions
)
if any(has_permission(request) for has_permission in permission_checks):
Expand Down
2 changes: 1 addition & 1 deletion src/unfold/checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def _check_unfold_action_permission_methods(self, obj: Any) -> List[checks.Error
if not hasattr(action.method, "allowed_permissions"):
continue
for permission in action.method.allowed_permissions:
method_name = "has_%s_permission" % permission
method_name = f"has_{permission}_permission"
if not hasattr(obj, method_name):
errors.append(
checks.Error(
Expand Down
6 changes: 3 additions & 3 deletions src/unfold/templatetags/unfold_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def result_headers(cl):
if is_sorted:
order_type = ordering_field_columns.get(i).lower()
sort_priority = list(ordering_field_columns).index(i) + 1
th_classes.append("sorted %sending" % order_type)
th_classes.append(f"sorted {order_type}ending")
new_order_type = {"asc": "desc", "desc": "asc"}[order_type]

# build new ordering param
Expand Down Expand Up @@ -211,7 +211,7 @@ def link_in_col(is_first: bool, field_name: str, cl: ChangeList) -> bool:
for field_index, field_name in enumerate(cl.list_display):
empty_value_display = cl.model_admin.get_empty_value_display()
row_classes = [
"field-%s" % _coerce_field_name(field_name, field_index),
f"field-{_coerce_field_name(field_name, field_index)}",
*ROW_CLASSES,
]

Expand Down Expand Up @@ -252,7 +252,7 @@ def link_in_col(is_first: bool, field_name: str, cl: ChangeList) -> bool:
f, (models.DateField, models.TimeField, models.ForeignKey)
):
row_classes.append("nowrap")
row_class = mark_safe(' class="%s"' % " ".join(row_classes))
row_class = mark_safe(f' class="{" ".join(row_classes)}"')
# If list_display_links not defined, add the link tag to the first field

if link_in_col(first, field_name, cl):
Expand Down