37 lines
1.2 KiB
Python
37 lines
1.2 KiB
Python
from django.contrib import admin
|
|
|
|
from .models import FreePracticeSession, PRSSession, PRSStage, SpeedShootingSession
|
|
|
|
|
|
class PRSStageInline(admin.TabularInline):
|
|
model = PRSStage
|
|
extra = 0
|
|
fields = [
|
|
'order', 'position', 'distance_m',
|
|
'target_width_cm', 'target_height_cm', 'max_time_s', 'shots_count',
|
|
'actual_elevation', 'actual_windage',
|
|
'hits', 'score', 'time_taken_s',
|
|
]
|
|
|
|
|
|
@admin.register(PRSSession)
|
|
class PRSSessionAdmin(admin.ModelAdmin):
|
|
list_display = ['__str__', 'user', 'date', 'location', 'competition_name', 'category']
|
|
list_filter = ['date']
|
|
search_fields = ['user__email', 'competition_name', 'location']
|
|
inlines = [PRSStageInline]
|
|
|
|
|
|
@admin.register(FreePracticeSession)
|
|
class FreePracticeSessionAdmin(admin.ModelAdmin):
|
|
list_display = ['__str__', 'user', 'date', 'location', 'distance_m', 'rounds_fired']
|
|
list_filter = ['date']
|
|
search_fields = ['user__email', 'name', 'location']
|
|
|
|
|
|
@admin.register(SpeedShootingSession)
|
|
class SpeedShootingSessionAdmin(admin.ModelAdmin):
|
|
list_display = ['__str__', 'user', 'date', 'format', 'rounds_fired']
|
|
list_filter = ['date']
|
|
search_fields = ['user__email', 'name', 'format']
|