1 # -*- coding: utf-8 -*-
2 # This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from django.utils.translation import ugettext_lazy as _
6 from django.contrib import admin
7 from .models import Offer, Order
10 class OfferAdmin(admin.ModelAdmin):
12 list_display = ['entry', 'price']
15 class PayedFilter(admin.SimpleListFilter):
16 title = _('payment complete')
17 parameter_name = 'payed'
18 def lookups(self, request, model_admin):
23 def queryset(self, request, queryset):
24 if self.value() == 'yes':
25 return queryset.exclude(payed_at=None)
26 elif self.value() == 'no':
27 return queryset.filter(payed_at=None)
29 class OrderAdmin(admin.ModelAdmin):
31 list_display = ['payed_at', 'offer', 'name', 'email']
32 search_fields = ['name', 'email', 'offer']
33 list_filter = [PayedFilter, 'offer']
35 admin.site.register(Offer, OfferAdmin)
36 admin.site.register(Order, OrderAdmin)