mirror of
https://github.com/FuzzyGrim/Yamtrack.git
synced 2026-03-03 02:27:01 +00:00
fix ruff errors
This commit is contained in:
@@ -116,7 +116,7 @@ def collect_creation_changes(new_record, history_model, media_type, user):
|
||||
for field in history_model._meta.get_fields():
|
||||
if (
|
||||
field.name.startswith("history_")
|
||||
or field.name in ["id"]
|
||||
or field.name == "id"
|
||||
or not hasattr(new_record, field.attname)
|
||||
or (field.name == "progress" and media_type == MediaTypes.MOVIE.value)
|
||||
):
|
||||
|
||||
@@ -272,7 +272,7 @@ def get_categories(item):
|
||||
for link in item.findall(".//link[@type='boardgamecategory']")
|
||||
if link.get("value")
|
||||
]
|
||||
return categories if categories else None
|
||||
return categories or None
|
||||
|
||||
|
||||
def get_designers(item):
|
||||
|
||||
@@ -213,7 +213,7 @@ def get_edition_details(edition_data):
|
||||
return {
|
||||
"format": edition_data.get("edition_format") or "Unknown",
|
||||
"publisher": publisher_name,
|
||||
"isbn": isbns if isbns else None,
|
||||
"isbn": isbns or None,
|
||||
"release_date": edition_data.get("release_date"),
|
||||
}
|
||||
|
||||
|
||||
@@ -161,7 +161,7 @@ def get_image_url(response):
|
||||
"""Get the image URL for a media item."""
|
||||
# when no image, value from response is null
|
||||
url = response["image"]["url"]["original"]
|
||||
return url if url else settings.IMG_NONE
|
||||
return url or settings.IMG_NONE
|
||||
|
||||
|
||||
def get_max_progress(response):
|
||||
|
||||
@@ -276,7 +276,7 @@ async def get_authors(response):
|
||||
data.get("name", "Unknown Author") for data in author_data_list if data
|
||||
]
|
||||
|
||||
return authors if authors else None
|
||||
return authors or None
|
||||
|
||||
|
||||
async def fetch_author_data(session, url):
|
||||
|
||||
@@ -22,7 +22,7 @@ class CustomListAdmin(admin.ModelAdmin):
|
||||
def get_last_update(self, obj):
|
||||
"""Return the date of the last item added."""
|
||||
last_update = CustomListItem.objects.get_last_added_date(obj)
|
||||
return last_update if last_update else "-"
|
||||
return last_update or "-"
|
||||
|
||||
get_last_update.short_description = "Last updated"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user