from django.contrib import admin from ledger.models import Payment from django.utils import timezone def repay(modeladmin, request, queryset): queryset.update(repayment=timezone.now()) repay.short_description = "Mark selected payments as repaid" class PaymentAdmin(admin.ModelAdmin): list_display = ["description", "amount", "date", "repayment"] ordering = ["date"] actions = [repay] admin.site.register(Payment, PaymentAdmin)