fnp
/
wolnelektury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add grammar to tags. Also: respect custom tag slugs on publishing.
[wolnelektury.git]
/
src
/
funding
/
admin.py
diff --git
a/src/funding/admin.py
b/src/funding/admin.py
index
5f552c4
..
6f29fbc
100644
(file)
--- a/
src/funding/admin.py
+++ b/
src/funding/admin.py
@@
-1,20
+1,22
@@
-# -*- coding: utf-8 -*-
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
# This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
-from django.utils.translation import
u
gettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from django.contrib import admin
from django.contrib import admin
+from modeltranslation.admin import TranslationAdmin
+from fnpdjango.actions import export_as_csv_action
from .models import Offer, Perk, Funding, Spent
from .models import Offer, Perk, Funding, Spent
-class OfferAdmin(
admin.Model
Admin):
+class OfferAdmin(
Translation
Admin):
model = Offer
list_display = ['title', 'author', 'target', 'sum', 'is_win', 'start', 'end']
search_fields = ['title', 'author']
readonly_fields = ('cover_img_tag',)
model = Offer
list_display = ['title', 'author', 'target', 'sum', 'is_win', 'start', 'end']
search_fields = ['title', 'author']
readonly_fields = ('cover_img_tag',)
+ autocomplete_fields = ['book']
-class PerkAdmin(
admin.Model
Admin):
+class PerkAdmin(
Translation
Admin):
model = Perk
search_fields = ['name', 'long_name']
list_display = ['name', 'long_name', 'price', 'end_date', 'offer']
model = Perk
search_fields = ['name', 'long_name']
list_display = ['name', 'long_name', 'price', 'end_date', 'offer']
@@
-33,9
+35,9
@@
class PayedFilter(admin.SimpleListFilter):
def queryset(self, request, queryset):
if self.value() == 'yes':
def queryset(self, request, queryset):
if self.value() == 'yes':
- return queryset.exclude(
pay
ed_at=None)
+ return queryset.exclude(
complet
ed_at=None)
elif self.value() == 'no':
elif self.value() == 'no':
- return queryset.filter(
pay
ed_at=None)
+ return queryset.filter(
complet
ed_at=None)
class PerksFilter(admin.SimpleListFilter):
class PerksFilter(admin.SimpleListFilter):
@@
-57,9
+59,16
@@
class PerksFilter(admin.SimpleListFilter):
class FundingAdmin(admin.ModelAdmin):
model = Funding
class FundingAdmin(admin.ModelAdmin):
model = Funding
- list_display = ['
pay
ed_at', 'offer', 'amount', 'name', 'email', 'perk_names']
+ list_display = ['
created_at', 'complet
ed_at', 'offer', 'amount', 'name', 'email', 'perk_names']
search_fields = ['name', 'email', 'offer__title', 'offer__author']
list_filter = [PayedFilter, 'offer', PerksFilter]
search_fields = ['name', 'email', 'offer__title', 'offer__author']
list_filter = [PayedFilter, 'offer', PerksFilter]
+ search_fields = ['user']
+ actions = [export_as_csv_action(
+ fields=[
+ 'id', 'offer', 'name', 'email', 'amount', 'completed_at',
+ 'notifications', 'notify_key', 'wl_optout_url'
+ ]
+ )]
class SpentAdmin(admin.ModelAdmin):
class SpentAdmin(admin.ModelAdmin):