Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion home/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ class about_Admin(ImportExportMixin, admin.ModelAdmin):
},
),
)
actions = ["export_as_csv", "generate_table"]
actions = ["export_as_csv", "generate_table", "disable_allocation"]

def generate_table(Student, request, queryset):
"""
Expand All @@ -315,6 +315,14 @@ def export_as_csv(self, request, queryset):

export_as_csv.short_description = "Export Student details to CSV"

def disable_allocation(self, request, queryset: list[Student]):
"""
Disable allocation action available in the admin page
"""
for obj in queryset:
obj.allocation_enabled = False
obj.save()


@admin.register(Scan)
class about_Admin(admin.ModelAdmin):
Expand Down