2018-03-02 12:01:51 +01:00
|
|
|
from django.contrib import admin
|
|
|
|
|
2018-03-13 09:24:12 +01:00
|
|
|
from gym.models import Room, Equipment, TheoreticalMax, Session, Round, Unit, WorkForm
|
2018-03-03 18:16:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
@admin.register(Room)
|
|
|
|
class RoomAdmin(admin.ModelAdmin):
|
2019-06-23 15:39:13 +02:00
|
|
|
list_display = ["name", "latitude", "longitude"]
|
2018-03-03 18:16:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
@admin.register(Equipment)
|
|
|
|
class EquipmentAdmin(admin.ModelAdmin):
|
2019-06-23 15:39:13 +02:00
|
|
|
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"]
|
2018-03-03 18:16:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
@admin.register(TheoreticalMax)
|
|
|
|
class TheoreticalMaxAdmin(admin.ModelAdmin):
|
2019-06-23 15:39:13 +02:00
|
|
|
list_display = ["equipment", "date", "value"]
|
|
|
|
list_display_links = ["equipment", "date"]
|
|
|
|
list_filter = ["equipment"]
|
|
|
|
date_hierarchy = "date"
|
2018-03-03 18:16:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
@admin.register(Session)
|
|
|
|
class SessionAdmin(admin.ModelAdmin):
|
2019-06-23 15:39:13 +02:00
|
|
|
list_display = ["start", "room", "default_theoretical_max_percentage"]
|
|
|
|
list_filter = ["room"]
|
|
|
|
date_hierarchy = "start"
|
2018-03-03 18:16:27 +01:00
|
|
|
|
|
|
|
|
|
|
|
@admin.register(Round)
|
|
|
|
class RoundAdmin(admin.ModelAdmin):
|
2019-06-23 15:39:13 +02:00
|
|
|
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"
|
2018-03-04 20:39:48 +01:00
|
|
|
|
|
|
|
|
|
|
|
@admin.register(Unit)
|
|
|
|
class UnitAdmin(admin.ModelAdmin):
|
|
|
|
pass
|
2018-03-13 09:24:12 +01:00
|
|
|
|
|
|
|
|
|
|
|
@admin.register(WorkForm)
|
|
|
|
class WorkFormAdmin(admin.ModelAdmin):
|
|
|
|
pass
|