feat(games): add steam pages with steam price/reduc
This commit is contained in:
@@ -8,6 +8,7 @@ from django_object_actions import (
|
||||
from submissions.tasks import sync_event_game_scopes_task
|
||||
|
||||
from .models import EventGame, Game
|
||||
from .tasks import refresh_steam_games_task
|
||||
|
||||
|
||||
class EventGameInline(admin.TabularInline):
|
||||
@@ -19,8 +20,30 @@ class EventGameInline(admin.TabularInline):
|
||||
class GameAdmin(admin.ModelAdmin):
|
||||
list_display = ["name", "steam_app_id", "updated_at"]
|
||||
search_fields = ["name", "steam_app_id"]
|
||||
readonly_fields = ["created_at", "updated_at"]
|
||||
readonly_fields = [
|
||||
"created_at",
|
||||
"updated_at",
|
||||
"steam_price_initial",
|
||||
"steam_price_final",
|
||||
"steam_discount_percent",
|
||||
"steam_currency",
|
||||
"steam_is_free",
|
||||
"steam_short_description",
|
||||
"steam_header_image",
|
||||
"steam_info_updated_at",
|
||||
]
|
||||
inlines = [EventGameInline]
|
||||
actions = ["refresh_steam_info"]
|
||||
|
||||
@admin.action(description="Refresh Steam store info")
|
||||
def refresh_steam_info(self, request, queryset):
|
||||
game_ids = list(
|
||||
queryset.filter(steam_app_id__isnull=False).values_list("id", flat=True)
|
||||
)
|
||||
refresh_steam_games_task.enqueue(game_ids=game_ids, reschedule=False)
|
||||
self.message_user(
|
||||
request, f"Queued Steam store refresh for {len(game_ids)} game(s)."
|
||||
)
|
||||
|
||||
|
||||
@admin.register(EventGame)
|
||||
|
||||
Reference in New Issue
Block a user