2019-10-26 15:25:21 +00:00
|
|
|
from django.contrib import admin
|
|
|
|
from ledger.models import Payment
|
2020-02-01 15:05:10 +00:00
|
|
|
from django.utils import timezone
|
2019-10-26 15:25:21 +00:00
|
|
|
|
2020-02-01 15:05:10 +00:00
|
|
|
def repay(modeladmin, request, queryset):
|
|
|
|
queryset.update(repayment=timezone.now())
|
2019-10-26 15:25:21 +00:00
|
|
|
|
2020-02-01 15:05:10 +00:00
|
|
|
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)
|