workout/gym/admin.py

62 lines
1.5 KiB
Python

from django.contrib import admin
from gym.models import Room, Equipment, TheoreticalMax, Session, Round, Unit, WorkForm
@admin.register(Room)
class RoomAdmin(admin.ModelAdmin):
list_display = ["name", "latitude", "longitude"]
@admin.register(Equipment)
class EquipmentAdmin(admin.ModelAdmin):
list_display = [
"name",
"room",
"unit",
"last_theoretical_max",
"default_work_form",
"default_repetition_number",
]
list_editable = ["default_work_form", "default_repetition_number"]
list_filter = ["room", "unit", "default_work_form"]
@admin.register(TheoreticalMax)
class TheoreticalMaxAdmin(admin.ModelAdmin):
list_display = ["equipment", "date", "value"]
list_display_links = ["equipment", "date"]
list_filter = ["equipment"]
date_hierarchy = "date"
@admin.register(Session)
class SessionAdmin(admin.ModelAdmin):
list_display = ["start", "room", "default_theoretical_max_percentage"]
list_filter = ["room"]
date_hierarchy = "start"
@admin.register(Round)
class RoundAdmin(admin.ModelAdmin):
list_display = [
"equipment",
"session",
"repetition_number",
"theoretical_max_percentage",
"chosen_weight",
"work_form",
]
list_display_links = ["equipment", "session"]
list_filter = ["equipment", "work_form"]
date_hierarchy = "session__start"
@admin.register(Unit)
class UnitAdmin(admin.ModelAdmin):
pass
@admin.register(WorkForm)
class WorkFormAdmin(admin.ModelAdmin):
pass