[boardgames] Make sure variants are filtered by game

This commit is contained in:
2026-07-05 00:15:26 -04:00
parent d6f71e0761
commit d5d0eb6cd8
2 changed files with 9 additions and 5 deletions

View File

@ -88,7 +88,7 @@ fetching and simple saving.
*** Metadata sources
**** Scraper
* Backlog [0/24] :vrobbler:project:personal:
* Backlog [1/25] :vrobbler:project:personal:
** TODO [#C] After transition to linux add curl_cffi as webpage scrapper again :webpages:metadata:
** TODO [#C] Create small utility to clean up tracks scrobbled with wonky playback times :bug:music:scrobbles:
:PROPERTIES:
@ -619,6 +619,10 @@ The Edit log form should have from top to bottom:
- Expansion ids (which should a multi-select widget of expansions for this game)
- Location (which should be a drop down of BoardGameLocations for this user)
** DONE [#A] Fix bug where all variants for board games are in form :boardgames:
:PROPERTIES:
:ID: 9c4cd193-580a-5b33-8832-1feffea7bd53
:END:
* Version 59.4 [2/2]
** DONE Fix bug in fetching expansions for board games :boardgames:
:PROPERTIES:

View File

@ -51,6 +51,7 @@ from music.aggregators import (
scrobble_counts,
week_of_scrobbles,
)
from boardgames.models import BoardGame, BoardGameVariant
from pendulum.parsing.exceptions import ParserError
from profiles.models import UserProfile
from profiles.utils import now_user_timezone
@ -1236,8 +1237,6 @@ class ScrobbleDetailView(DetailView):
return self.object.media_obj.logdata_cls().form()
def _update_board_game_widgets(self, form):
from boardgames.models import BoardGame
if not isinstance(self.object.media_obj, BoardGame):
return
@ -1248,6 +1247,9 @@ class ScrobbleDetailView(DetailView):
form.fields["expansion_ids"].queryset = expansions
if "variant_ids" in form.fields:
form.fields["variant_ids"].queryset = BoardGameVariant.objects.filter(
board_game=self.object.media_obj
)
form.fields["variant_ids"].widget.attrs["data-board-game-id"] = (
self.object.media_obj.id
)
@ -1957,8 +1959,6 @@ class EmbeddableTopBoardGamesWidget(BaseEmbeddableWidget):
scrobble_filter = {"scrobble__played_to_completion": True}
def get_items(self, user, start_date, end_date):
from boardgames.models import BoardGame
return super().get_items(user, start_date, end_date, BoardGame)