further fixes for card_multiselect breaking when removing all items; values are now static and quanity is stored in data-quantity. Also fix searching via label and change card_multiselect to accept list of cards instead of card_filter
This commit is contained in:
parent
b97ddde71c
commit
3df4b41750
7 changed files with 76 additions and 59 deletions
|
|
@ -46,7 +46,7 @@ class TradeOfferCreateView(LoginRequiredMixin, CreateView):
|
|||
context = super().get_context_data(**kwargs)
|
||||
from cards.models import Card
|
||||
# Ensure available_cards is a proper QuerySet
|
||||
context["available_cards"] = Card.objects.all().order_by("name", "rarity__pk") \
|
||||
context["cards"] = Card.objects.all().order_by("name", "rarity__pk") \
|
||||
.select_related("rarity", "cardset") \
|
||||
.prefetch_related("decks")
|
||||
friend_codes = self.request.user.friend_codes.all()
|
||||
|
|
@ -335,7 +335,7 @@ class TradeOfferSearchView(LoginRequiredMixin, ListView):
|
|||
context = super().get_context_data(**kwargs)
|
||||
from cards.models import Card
|
||||
# Populate available_cards to re-populate the multiselects.
|
||||
context["available_cards"] = Card.objects.all().order_by("name", "rarity__pk") \
|
||||
context["cards"] = Card.objects.all().order_by("name", "rarity__pk") \
|
||||
.select_related("rarity", "cardset")
|
||||
if self.request.method == "POST":
|
||||
context["offered_cards"] = self.request.POST.getlist("offered_cards")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue