k4ever/k4ever/transaction/admin.py

26 lines
975 B
Python

# -*- coding: utf-8 -*-
from models import Transaction, TransactionType
from django.contrib import admin
class TransactionAdmin(admin.ModelAdmin):
list_filter = ('checked','transactionType','amount')
actions = ['really_delete_selected']
def get_actions(self, request):
actions = super(TransactionAdmin, self).get_actions(request)
del actions['delete_selected']
return actions
# FIXME: Can we instead of replacing the whole page just
# hook the release process? Also - make this nicer
# in terms of localization/naming foo
def really_delete_selected(self, request, queryset):
for obj in queryset:
obj.delete()
num = queryset.count()
message = "%s transaction%s" % (num, (num != 1 and "s" or ""))
self.message_user(request, u"Erfolgreich %s gelöscht." % message)
really_delete_selected.short_description = u"Ausgewählte transactions löschen"
admin.site.register(Transaction, TransactionAdmin)
admin.site.register(TransactionType)