init commit
This commit is contained in:
27
superset/admin.py
Normal file
27
superset/admin.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from django.contrib import admin
|
||||
from import_export.admin import ImportExportModelAdmin
|
||||
from .models import *
|
||||
|
||||
# Register your models here.
|
||||
@admin.register(SupersetExercise)
|
||||
class SupersetExerciseAdmin(ImportExportModelAdmin):
|
||||
search_fields = ['exercise__name']
|
||||
|
||||
|
||||
class SupersetExerciseInline(admin.StackedInline):
|
||||
model = SupersetExercise
|
||||
ordering = ("pk",)
|
||||
extra = 0
|
||||
|
||||
@admin.register(Superset)
|
||||
class SupersetAdmin(ImportExportModelAdmin):
|
||||
list_display = ("name", "workout", "order", "rounds", "get_workout_id", "estimated_time",)
|
||||
ordering = ("order",)
|
||||
inlines = [
|
||||
SupersetExerciseInline,
|
||||
]
|
||||
|
||||
def get_workout_id(self, obj):
|
||||
return obj.workout.id
|
||||
get_workout_id.admin_order_field = 'workout_id' #Allows column order sorting
|
||||
get_workout_id.short_description = 'Workout id' #Renames column head
|
||||
Reference in New Issue
Block a user