Files
polylan-submitter/polylan_submitter/games/admin.py
T

24 lines
603 B
Python

from django.contrib import admin
from .models import EventGame, Game
class EventGameInline(admin.TabularInline):
model = EventGame
extra = 0
@admin.register(Game)
class GameAdmin(admin.ModelAdmin):
list_display = ["name", "steam_app_id", "updated_at"]
search_fields = ["name", "steam_app_id"]
readonly_fields = ["created_at", "updated_at"]
inlines = [EventGameInline]
@admin.register(EventGame)
class EventGameAdmin(admin.ModelAdmin):
list_display = ["game", "event", "enabled"]
list_filter = ["event", "enabled"]
search_fields = ["game__name", "event__name"]