# 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
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):
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2013-07-26 10:00+0200\n"
-"PO-Revision-Date: 2013-07-30 14:26+0100\n"
+"POT-Creation-Date: 2013-08-02 14:02+0200\n"
+"PO-Revision-Date: 2013-08-02 14:00+0100\n"
"Last-Translator: Radek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"|| 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"
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"
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!"
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({