From b78791b6c6ace71524e767f9d1a527972e5ba338 Mon Sep 17 00:00:00 2001 From: Radek Czajka Date: Fri, 2 Aug 2013 14:03:15 +0200 Subject: [PATCH] fixes #2930: info about perks in admin. --- apps/funding/admin.py | 37 ++++++++++- apps/funding/locale/pl/LC_MESSAGES/django.mo | Bin 13502 -> 13636 bytes apps/funding/locale/pl/LC_MESSAGES/django.po | 63 +++++++++++-------- apps/funding/models.py | 3 + 4 files changed, 77 insertions(+), 26 deletions(-) diff --git a/apps/funding/admin.py b/apps/funding/admin.py index c8a25d013..d70aef66a 100644 --- a/apps/funding/admin.py +++ b/apps/funding/admin.py @@ -2,6 +2,7 @@ # 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 ugettext_lazy as _ from django.contrib import admin from .models import Offer, Perk, Funding, Spent @@ -15,13 +16,47 @@ class OfferAdmin(admin.ModelAdmin): class PerkAdmin(admin.ModelAdmin): model = Perk + search_fields = ['name', 'long_name'] list_display = ['name', 'long_name', 'price', 'end_date', 'offer'] + list_filter = ['offer'] + + + +class PayedFilter(admin.SimpleListFilter): + title = _('payment complete') + parameter_name = 'payed' + def lookups(self, request, model_admin): + return ( + ('yes', _('Yes')), + ('no', _('No')), + ) + def queryset(self, request, queryset): + if self.value() == 'yes': + return queryset.exclude(payed_at=None) + elif self.value() == 'no': + return queryset.filter(payed_at=None) + +class PerksFilter(admin.SimpleListFilter): + title = _('perks') + parameter_name = 'perks' + def lookups(self, request, model_admin): + return ( + ('yes', _('Yes')), + ('no', _('No')), + ) + def queryset(self, request, queryset): + if self.value() == 'yes': + return queryset.exclude(perks=None) + elif self.value() == 'no': + return queryset.filter(perks=None) class FundingAdmin(admin.ModelAdmin): model = Funding - list_display = ['payed_at', 'offer', 'amount', 'name', 'email'] + list_display = ['payed_at', 'offer', 'amount', 'name', 'email', 'perk_names'] search_fields = ['name', 'email', 'offer__title', 'offer__author'] + list_filter = [PayedFilter, 'offer', PerksFilter] + class SpentAdmin(admin.ModelAdmin): diff --git a/apps/funding/locale/pl/LC_MESSAGES/django.mo b/apps/funding/locale/pl/LC_MESSAGES/django.mo index dbd4471310c6b5d781686d4300a97a69505b67e4..9f86a860d9b3ea584cc9bf85fe62f4d4abeb4c09 100644 GIT binary patch delta 2740 zcmY+_3rv<(9LMp)3-SV?D55Beyvao{k&7Z%5i-OZAc|(%1yp=PZgTMgYrRXR)zoY& zvMp>(-E8TW?JZ?vG+MGz%PuQiy3!_YY`LN`=jK}W{XNg)R%ia7&p8jzd(L^z`Jcy6 z>Mrf_U5^avHkAFuY~sg2V@_d@n+qj5%$NvF!7j{o9Kc}O#g7;hiYsv&uE%2h7}do+ zjKK#u31h;InSd!c(HNgeqcW8nOECy5aT;zybpm99CPtHY6WIQ8WW9a7=op! ziLXQcnXOz_VH0Y?eW<^Gk7alRAH`IbYaLdgFNaDml?8Ye&tWj5&qP0J$u46oW-#+fM;SZ?fT+TAc)u=71MDoyVMJ1tk7VEE$8@Zt+Z9zA7 zI_(2!?Je?hrW>_2XHk1Ph#FuB$uILIs^e?U{hv|&jv?D^ena#QtRKO(IF33#1^k-Hn^JUR9crK!)Nwq7dh>TtEB7I0 zqbJ!u6`Qeub{p#X^QhksV<_XBpQyNT%z0oOOK7`O*jFq=y~J(yw7s1;wMeFF8v1#I91 z>~ee+wNl4WNp>8AvB&WgPNe-l>bXA0K@6uoj3mApL9OiFOx9lmL~(ZXKn$vbc^HCO zj)l(OOHnIOg&LsM`Fkg7LR}bvuQ=_uF_iWRoP=la0A4^%Jl99&ZKYC#k=TRF@B=Kz zanuA0v)DJRB_0+&idI?9Rh_jFdRAqljkSH&Uei`CsAz%@i%%J^rB>nNWPP`-1{b#1 zDivIxA((?TDc#H?N{DvCMd&TbFSCPaCRFATyND;%aEex8E%6+YsPnH?5)@el8VdZy`a#n@Zwo zqLENx2dw`znlOjZ{%;|wh-HMzDq^)&voFex`v0^SQeQ&oJ5cJ}SDr=N?{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5h{Izj+qMi`hRJ1H7&E2{y}0TkwcJYp>28uwSBvYorF$FFHxrRuYI2@UMi2yHL!=s zB3cNQO@#8Hir7x5=>G|Q(NyNo68d}Oj(R8cB%<40dmJl>aP4^>aW_#(sALjbi5jAg zNGFaG`v_(49-@tCAmRueSx#Cg0X?X)o=~FcL)A_kBUT5~y%ABt+@#~N!MB#yd4ith yi5~BU{GyVyLVu~>e>T\n" "Language-Team: LANGUAGE \n" +"Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -18,6 +19,22 @@ msgstr "" "|| n%100>=20) ? 1 : 2);\n" "X-Generator: Poedit 1.5.4\n" +#: admin.py:26 +msgid "payment complete" +msgstr "płatność doszła do skutku" + +#: admin.py:30 admin.py:44 +msgid "Yes" +msgstr "Tak" + +#: admin.py:31 admin.py:45 +msgid "No" +msgstr "Nie" + +#: admin.py:40 models.py:197 models.py:215 +msgid "perks" +msgstr "prezenty" + #: forms.py:16 templates/funding/wlfund.html:27 msgid "Amount" msgstr "Kwota" @@ -111,7 +128,7 @@ msgstr "Wysłano powiadomienia o zakończeniu" msgid "Cover preview" msgstr "Podgląd okładki" -#: models.py:45 models.py:186 models.py:207 +#: models.py:45 models.py:189 models.py:210 msgid "offer" msgstr "zbiórka" @@ -119,79 +136,75 @@ msgstr "zbiórka" msgid "offers" msgstr "zbiórki" -#: models.py:141 +#: models.py:144 msgid "The fundraiser has ended!" msgstr "Zbiórka dobiegła końca!" -#: models.py:157 +#: models.py:160 msgid "The fundraiser will end soon!" msgstr "Zbiórka niedługo się zakończy!" -#: models.py:171 +#: models.py:174 msgid "The book you helped fund has been published." msgstr "Książka, którą pomogłeś/-aś ufundować, została opublikowana." -#: models.py:187 +#: models.py:190 msgid "price" msgstr "cena" -#: models.py:188 models.py:208 +#: models.py:191 models.py:211 msgid "name" msgstr "nazwa" -#: models.py:189 +#: models.py:192 msgid "long name" msgstr "długa nazwa" -#: models.py:190 +#: models.py:193 msgid "end date" msgstr "data końcowa" -#: models.py:193 +#: models.py:196 msgid "perk" msgstr "prezent" -#: models.py:194 models.py:212 -msgid "perks" -msgstr "prezenty" - -#: models.py:209 +#: models.py:212 msgid "email" msgstr "e-mail" -#: models.py:210 models.py:287 +#: models.py:213 models.py:293 msgid "amount" msgstr "kwota" -#: models.py:211 +#: models.py:214 msgid "payed at" msgstr "data wpłaty" -#: models.py:214 +#: models.py:217 msgid "notifications" msgstr "powiadomienia" -#: models.py:218 +#: models.py:221 msgid "funding" msgstr "wpłata" -#: models.py:219 templates/admin/funding/offer/change_form.html:22 +#: models.py:222 templates/admin/funding/offer/change_form.html:22 msgid "fundings" msgstr "wpłaty" -#: models.py:288 +#: models.py:294 msgid "when" msgstr "kiedy" -#: models.py:291 +#: models.py:297 msgid "money spent on a book" msgstr "pieniądze wydane na książkę" -#: models.py:292 +#: models.py:298 msgid "money spent on books" msgstr "pieniądze wydane na książki" -#: models.py:318 templates/funding/thanks.html:6 +#: models.py:324 templates/funding/thanks.html:6 #: templates/funding/thanks.html.py:13 msgid "Thank you for your support!" msgstr "Dziękujemy za Twoje wsparcie!" diff --git a/apps/funding/models.py b/apps/funding/models.py index 0bd5360f9..de52ac9d8 100644 --- a/apps/funding/models.py +++ b/apps/funding/models.py @@ -233,6 +233,9 @@ class Funding(models.Model): def get_absolute_url(self): return reverse('funding_funding', args=[self.pk]) + def perk_names(self): + return ", ".join(perk.name for perk in self.perks.all()) + def get_disable_notifications_url(self): return "%s?%s" % (reverse("funding_disable_notifications"), urlencode({ -- 2.20.1