from puzzles.models import Puzzle, PuzzleManufacturer
from django.contrib import admin
from scrobbles.admin import ScrobbleInline


class PuzzleInline(admin.TabularInline):
    model = Puzzle
    extra = 0


@admin.register(PuzzleManufacturer)
class PuzzleManufacturerAdmin(admin.ModelAdmin):
    date_hierarchy = "created"
    search_fields = ("name",)


@admin.register(Puzzle)
class PuzzleAdmin(admin.ModelAdmin):
    date_hierarchy = "created"
    list_display = (
        "uuid",
        "title",
    )
    ordering = ("-created",)
    search_fields = ("title",)
    inlines = [
        ScrobbleInline,
    ]
