Skip to content

Commit

Permalink
Use this new placholder poster on anime pages that need it.
Browse files Browse the repository at this point in the history
  • Loading branch information
colons committed Feb 15, 2024
1 parent f737af8 commit 081299f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
7 changes: 1 addition & 6 deletions nkdsu/apps/vote/placeholder_avatars.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@
from .voter import Voter


__all__ = ['placeholder_art_for', 'placeholder_avatar_for']


def placeholder_art_for(string: str) -> str:
hashed: int = crc32(string.encode())
return _static_path_from_filename(AVATAR_FILENAMES[hashed % len(AVATAR_FILENAMES)])
__all__ = ['placeholder_avatar_for']


def placeholder_avatar_for(voter: Voter) -> str:
Expand Down
3 changes: 1 addition & 2 deletions nkdsu/apps/vote/views/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
TwitterUser,
Vote,
)
from ..placeholder_avatars import placeholder_art_for
from ..templatetags.vote_tags import eligible_for
from ..utils import BrowsableItem, BrowsableYear, vote_edit_cutoff
from ..voter import Voter
Expand Down Expand Up @@ -560,7 +559,7 @@ def get(self, request: HttpRequest, *args, **kwargs) -> HttpResponse:
try:
anime_data.cache_picture()
except RequestException:
return redirect(static(placeholder_art_for(anime_data.picture)))
return redirect(static('i/naidesu.svg'))

return redirect(anime_data.cached_picture_url())

Expand Down

0 comments on commit 081299f

Please sign in to comment.