1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from django.contrib import admin
6 from .models import Offer, Perk, Funding, Spent
9 class OfferAdmin(admin.ModelAdmin):
11 list_display = ['title', 'author', 'target', 'sum', 'is_win', 'start', 'end']
12 search_fields = ['title', 'author']
13 readonly_fields = ('cover_img_tag',)
16 class PerkAdmin(admin.ModelAdmin):
18 list_display = ['name', 'long_name', 'price', 'end_date', 'offer']
21 class FundingAdmin(admin.ModelAdmin):
23 list_display = ['payed_at', 'offer', 'amount', 'name', 'email']
24 search_fields = ['name', 'email', 'offer__title', 'offer__author']
27 class SpentAdmin(admin.ModelAdmin):
29 list_display = ['book', 'amount', 'timestamp']
30 search_fields = ['book__title']
33 admin.site.register(Offer, OfferAdmin)
34 admin.site.register(Perk, PerkAdmin)
35 admin.site.register(Funding, FundingAdmin)
36 admin.site.register(Spent, SpentAdmin)