use <a> tags for card_badge and trade_offer clickable areas (except for main card_badge row on trade_offers, still uses @click for now because the a tag can't wrap that content for some reason). closes #14

This commit is contained in:
badblocks 2025-04-15 00:15:08 -07:00
parent 86b061c971
commit afaa392b2f
22 changed files with 247 additions and 227 deletions

View file

@ -22,8 +22,8 @@ class HomePageView(TemplateView):
context = super().get_context_data(**kwargs)
try:
# Get all cards ordered by name
context["cards"] = Card.objects.all().order_by("name")
# Get all cards ordered by name, exclude cards with rarity level > 5
context["cards"] = Card.objects.filter(rarity_level__lte=5).order_by("name", "rarity_level")
# Reuse base trade offer queryset for market stats
base_offer_qs = TradeOffer.objects.filter(is_closed=False)
@ -39,7 +39,7 @@ class HomePageView(TemplateView):
# Most Offered Cards
try:
context["most_offered_cards"] = (
Card.objects.filter(tradeofferhavecard__isnull=False)
Card.objects.filter(tradeofferhavecard__isnull=False).filter(rarity_level__lte=5)
.annotate(offer_count=Sum("tradeofferhavecard__quantity"))
.order_by("-offer_count")[:6]
)
@ -50,7 +50,7 @@ class HomePageView(TemplateView):
# Most Wanted Cards
try:
context["most_wanted_cards"] = (
Card.objects.filter(tradeofferwantcard__isnull=False)
Card.objects.filter(tradeofferwantcard__isnull=False).filter(rarity_level__lte=5)
.annotate(offer_count=Sum("tradeofferwantcard__quantity"))
.order_by("-offer_count")[:6]
)
@ -61,7 +61,7 @@ class HomePageView(TemplateView):
# Least Offered Cards
try:
context["least_offered_cards"] = (
Card.objects.annotate(
Card.objects.filter(rarity_level__lte=5).annotate(
offer_count=Coalesce(Sum("tradeofferhavecard__quantity"), 0)
)
.order_by("offer_count")[:6]