implement fallback assignment admin view, dumb random fallback assignment
parent
5f434adf05
commit
01ac707ab7
@ -1,11 +1,21 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from .models import TeamMember
|
from .models import *
|
||||||
|
|
||||||
|
def assign_random_shifts(modeladmin, request, queryset):
|
||||||
|
for member in queryset:
|
||||||
|
member.assign_random_shifts()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Register your models here.
|
# Register your models here.
|
||||||
|
|
||||||
|
class FallbackAssignmentinline(admin.TabularInline):
|
||||||
|
model = FallbackAssignment
|
||||||
|
|
||||||
@admin.register(TeamMember)
|
@admin.register(TeamMember)
|
||||||
class TeamMemberAdmin(admin.ModelAdmin):
|
class TeamMemberAdmin(admin.ModelAdmin):
|
||||||
fields = ["name"]
|
fields = ["name"]
|
||||||
list_display = ["name"]
|
list_display = ["name"]
|
||||||
|
inlines = (FallbackAssignmentinline,)
|
||||||
|
actions = (assign_random_shifts,)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue