from django.contrib import admin
from django.contrib.contenttypes.admin import GenericTabularInline

from .models import Transaction


class TransactionAdmin(admin.ModelAdmin):
    list_display = ('amount', 'status', 'transaction_type',
                    'content_object', 'created',)
    search_fields = ('secret', )


class TransactionInlineAdmin(GenericTabularInline):
    model = Transaction

    def has_add_permission(self, request):
        return False


admin.site.register(Transaction, TransactionAdmin)

@@ -1,24 +1,74 @@
+from django.contrib.admin import SimpleListFilter%0A
 from django.contrib impo
@@ -76,16 +76,16 @@
 t admin%0A
-
 from dja
@@ -178,16 +178,615 @@
 ction%0A%0A%0A
+class ContentTypeFilter(SimpleListFilter):%0A    title = 'purchase type'%0A    parameter_name = 'type'%0A%0A    def lookups(self, request, model_admin):%0A        ctypes = Transaction.objects.values_list(%0A            'content_type__id', 'content_type__app_label',%0A            'content_type__model') %5C%0A            .order_by('content_type__id').distinct()%0A        return %5B(c%5B0%5D, (u%22%25s: %25s%22 %25 c%5B1:%5D).title()) for c in ctypes%5D%0A%0A    def queryset(self, request, queryset):%0A        if self.value():%0A            return queryset.filter(content_type__id__exact=self.value())%0A        else:%0A            return queryset%0A%0A%0A
 class Tr
@@ -929,16 +929,16 @@
 ated',)%0A
-
     sear
@@ -962,16 +962,56 @@
 ret', )%0A
+    list_filter = (ContentTypeFilter, )%0A
 %0A%0Aclass 

Add content type filtering to transaction admin