1 from django.contrib import admin
2 from .models import Offer, Perk, Funding, Spent
5 class OfferAdmin(admin.ModelAdmin):
7 list_display = ['title', 'author', 'target', 'sum', 'is_win', 'start', 'end', 'due']
8 search_fields = ['title', 'author']
9 readonly_fields = ('cover_img_tag',)
12 class PerkAdmin(admin.ModelAdmin):
14 list_display = ['name', 'long_name', 'price', 'end_date', 'offer']
17 class FundingAdmin(admin.ModelAdmin):
19 list_display = ['payed_at', 'offer', 'amount', 'name', 'email']
20 search_fields = ['name', 'email', 'offer__title', 'offer__author']
23 class SpentAdmin(admin.ModelAdmin):
25 list_display = ['book', 'amount', 'timestamp']
26 search_fields = ['book__title']
29 admin.site.register(Offer, OfferAdmin)
30 admin.site.register(Perk, PerkAdmin)
31 admin.site.register(Funding, FundingAdmin)
32 admin.site.register(Spent, SpentAdmin)