Merge branch 'master' into funding
authorAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 25 Jun 2013 10:08:40 +0000 (12:08 +0200)
committerAleksander Łukasz <aleksander.lukasz@nowoczesnapolska.org.pl>
Tue, 25 Jun 2013 10:08:40 +0000 (12:08 +0200)
97 files changed:
.gitignore
apps/catalogue/tasks.py
apps/funding/__init__.py [new file with mode: 0644]
apps/funding/admin.py [new file with mode: 0644]
apps/funding/forms.py [new file with mode: 0644]
apps/funding/locale/pl/LC_MESSAGES/django.mo [new file with mode: 0644]
apps/funding/locale/pl/LC_MESSAGES/django.po [new file with mode: 0644]
apps/funding/migrations/0001_initial.py [new file with mode: 0644]
apps/funding/migrations/0002_auto__add_spent__del_field_offer_book_url__add_field_offer_book.py [new file with mode: 0644]
apps/funding/migrations/0003_auto__add_field_offer_due.py [new file with mode: 0644]
apps/funding/migrations/0004_auto__add_field_funding_anonymous.py [new file with mode: 0644]
apps/funding/migrations/0005_auto__chg_field_funding_payed_at.py [new file with mode: 0644]
apps/funding/migrations/0006_auto__del_field_funding_anonymous.py [new file with mode: 0644]
apps/funding/migrations/0007_auto__add_field_perk_end_date.py [new file with mode: 0644]
apps/funding/migrations/0008_auto__add_field_offer_description.py [new file with mode: 0644]
apps/funding/migrations/0009_auto.py [new file with mode: 0644]
apps/funding/migrations/0010_auto.py [new file with mode: 0644]
apps/funding/migrations/0011_auto__add_field_offer_cover.py [new file with mode: 0644]
apps/funding/migrations/0012_auto__add_field_offer_poll.py [new file with mode: 0644]
apps/funding/migrations/__init__.py [new file with mode: 0644]
apps/funding/models.py [new file with mode: 0644]
apps/funding/static/funding/funding.css [new file with mode: 0755]
apps/funding/static/funding/funding.js [new file with mode: 0644]
apps/funding/static/funding/funding.scss [new file with mode: 0755]
apps/funding/templates/funding/email.txt [new file with mode: 0644]
apps/funding/templates/funding/no_thanks.html [new file with mode: 0755]
apps/funding/templates/funding/offer_detail.html [new file with mode: 0755]
apps/funding/templates/funding/offer_list.html [new file with mode: 0755]
apps/funding/templates/funding/snippets/any_remaining.html [new file with mode: 0755]
apps/funding/templates/funding/tags/funding.html [new file with mode: 0755]
apps/funding/templates/funding/tags/offer_status.html [new file with mode: 0755]
apps/funding/templates/funding/tags/offer_status_more.html [new file with mode: 0755]
apps/funding/templates/funding/thanks.html [new file with mode: 0755]
apps/funding/templates/funding/widgets/amount.html [new file with mode: 0644]
apps/funding/templates/funding/wlfund.html [new file with mode: 0755]
apps/funding/templatetags/__init__.py [new file with mode: 0755]
apps/funding/templatetags/funding_tags.py [new file with mode: 0755]
apps/funding/tests.py [new file with mode: 0644]
apps/funding/urls.py [new file with mode: 0644]
apps/funding/views.py [new file with mode: 0644]
apps/funding/widgets.py [new file with mode: 0644]
apps/lesmianator/templates/lesmianator/lesmianator.html
apps/modeltranslation/fields.py
apps/oai/handlers.py
apps/pdcounter/static/pdcounter/pdcounter.js
apps/pdcounter/templates/pdcounter/author_detail.html
apps/pdcounter/templates/pdcounter/book_stub_detail.html
apps/pdcounter/templatetags/__init__.py [new file with mode: 0755]
apps/pdcounter/templatetags/time_tags.py [new file with mode: 0755]
apps/pdcounter/views.py
apps/polls/__init__.py [new file with mode: 0644]
apps/polls/admin.py [new file with mode: 0644]
apps/polls/forms.py [new file with mode: 0644]
apps/polls/locale/pl/LC_MESSAGES/django.mo [new file with mode: 0644]
apps/polls/locale/pl/LC_MESSAGES/django.po [new file with mode: 0644]
apps/polls/migrations/0001_initial.py [new file with mode: 0644]
apps/polls/migrations/__init__.py [new file with mode: 0644]
apps/polls/models.py [new file with mode: 0644]
apps/polls/static/polls/polls.css [new file with mode: 0644]
apps/polls/static/polls/polls.scss [new file with mode: 0644]
apps/polls/templates/polls/poll.html [new file with mode: 0644]
apps/polls/templates/polls/tags/poll.html [new file with mode: 0644]
apps/polls/templatetags/__init__.py [new file with mode: 0644]
apps/polls/templatetags/polls_tags.py [new file with mode: 0644]
apps/polls/urls.py [new file with mode: 0644]
apps/polls/views.py [new file with mode: 0644]
apps/wolnelektury_core/static/css/base.css
apps/wolnelektury_core/static/css/book_box.css
apps/wolnelektury_core/static/css/catalogue.css
apps/wolnelektury_core/static/css/core.css
apps/wolnelektury_core/static/css/form.css [new file with mode: 0644]
apps/wolnelektury_core/static/css/form.scss [new file with mode: 0644]
apps/wolnelektury_core/static/css/header.css
apps/wolnelektury_core/static/css/main_page.css
apps/wolnelektury_core/static/img/progress-pixel.png [new file with mode: 0644]
apps/wolnelektury_core/static/img/social/bigfacebook.png [new file with mode: 0644]
apps/wolnelektury_core/static/img/social/biggoogle.png [new file with mode: 0644]
apps/wolnelektury_core/static/img/social/bignk.png [new file with mode: 0644]
apps/wolnelektury_core/static/img/social/bigtwitter.png [new file with mode: 0644]
apps/wolnelektury_core/templates/superbase.html
apps/wolnelektury_core/views.py
lib/pyscss_compiler.py [new file with mode: 0644]
requirements.txt
wolnelektury/migrations/__init__.py [new file with mode: 0644]
wolnelektury/migrations/getpaid/0001_initial.py [new file with mode: 0644]
wolnelektury/migrations/getpaid/0002_auto__add_field_payment_external_id__add_field_payment_description.py [new file with mode: 0644]
wolnelektury/migrations/getpaid/__init__.py [new file with mode: 0644]
wolnelektury/migrations/getpaid_payu/0001_initial.py [new file with mode: 0644]
wolnelektury/migrations/getpaid_payu/__init__.py [new file with mode: 0644]
wolnelektury/settings/__init__.py
wolnelektury/settings/basic.py
wolnelektury/settings/contrib.py
wolnelektury/settings/custom.py
wolnelektury/settings/locale.py
wolnelektury/settings/static.py
wolnelektury/urls.py
wolnelektury/utils.py [new file with mode: 0644]

index c3e3e48..6714e23 100644 (file)
@@ -5,6 +5,7 @@ dev.sqlite
 *~
 *.orig
 *.log
+.sass-cache
 
 # Compress output
 /static
index e7f7b29..d5e8529 100644 (file)
@@ -6,13 +6,14 @@ from datetime import datetime
 from traceback import print_exc
 from celery.task import task
 from django.conf import settings
+from wolnelektury.utils import localtime_to_utc
 
 
 # TODO: move to model?
 def touch_tag(tag):
     update_dict = {
         'book_count': tag.get_count(),
-        'changed_at': datetime.now(),
+        'changed_at': localtime_to_utc(datetime.now()),
     }
 
     type(tag).objects.filter(pk=tag.pk).update(**update_dict)
diff --git a/apps/funding/__init__.py b/apps/funding/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/apps/funding/admin.py b/apps/funding/admin.py
new file mode 100644 (file)
index 0000000..44e94ad
--- /dev/null
@@ -0,0 +1,32 @@
+from django.contrib import admin
+from .models import Offer, Perk, Funding, Spent
+
+
+class OfferAdmin(admin.ModelAdmin):
+    model = Offer
+    list_display = ['title', 'author', 'target', 'sum', 'is_win', 'start', 'end', 'due']
+    search_fields = ['title', 'author']
+    readonly_fields = ('cover_img_tag',)
+
+
+class PerkAdmin(admin.ModelAdmin):
+    model = Perk
+    list_display = ['name', 'price', 'end_date', 'offer']
+
+
+class FundingAdmin(admin.ModelAdmin):
+    model = Funding
+    list_display = ['payed_at', 'offer', 'amount', 'name', 'email']
+    search_fields = ['name', 'email', 'offer__title', 'offer__author']
+
+
+class SpentAdmin(admin.ModelAdmin):
+    model = Spent
+    list_display = ['book', 'amount', 'timestamp']
+    search_fields = ['book__title']
+
+
+admin.site.register(Offer, OfferAdmin)
+admin.site.register(Perk, PerkAdmin)
+admin.site.register(Funding, FundingAdmin)
+admin.site.register(Spent, SpentAdmin)
diff --git a/apps/funding/forms.py b/apps/funding/forms.py
new file mode 100644 (file)
index 0000000..f566e8e
--- /dev/null
@@ -0,0 +1,40 @@
+from django import forms
+from django.utils.translation import ugettext_lazy as _, ugettext as __
+from .models import Funding
+from .widgets import PerksAmountWidget
+
+
+class FundingForm(forms.Form):
+    required_css_class = 'required'
+
+    amount = forms.DecimalField(label=_("Amount"), decimal_places=2,
+        widget=PerksAmountWidget())
+    name = forms.CharField(label=_("Name"), required=False,
+        help_text=_("Optional name for public list of contributors"))
+    email = forms.EmailField(label=_("Contact e-mail"),
+        help_text=_("We'll use it to contact you about your perks and fundraiser status and payment updates.<br/> "
+            "Won't be publicised."), required=False)
+
+    def __init__(self, offer, *args, **kwargs):
+        self.offer = offer
+        super(FundingForm, self).__init__(*args, **kwargs)
+        self.fields['amount'].widget.form_instance = self
+
+    def clean_amount(self):
+        if self.cleaned_data['amount'] <= 0:
+            raise forms.ValidationError(__("Enter positive amount."))
+        return self.cleaned_data['amount']
+
+    def clean(self):
+        if not self.offer.is_current():
+            raise forms.ValidationError(__("This offer is out of date."))
+        return self.cleaned_data
+
+    def save(self):
+        return Funding.objects.create(
+            offer=self.offer,
+            name=self.cleaned_data['name'],
+            email=self.cleaned_data['email'],
+            amount=self.cleaned_data['amount'],
+        )
+
diff --git a/apps/funding/locale/pl/LC_MESSAGES/django.mo b/apps/funding/locale/pl/LC_MESSAGES/django.mo
new file mode 100644 (file)
index 0000000..e2cc757
Binary files /dev/null and b/apps/funding/locale/pl/LC_MESSAGES/django.mo differ
diff --git a/apps/funding/locale/pl/LC_MESSAGES/django.po b/apps/funding/locale/pl/LC_MESSAGES/django.po
new file mode 100644 (file)
index 0000000..0543b8a
--- /dev/null
@@ -0,0 +1,430 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-06-25 11:55+0200\n"
+"PO-Revision-Date: 2013-04-25 13:03+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"
+"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
+"|| n%100>=20) ? 1 : 2)\n"
+
+#: forms.py:10 templates/funding/wlfund.html:28
+msgid "Amount"
+msgstr "Kwota"
+
+#: forms.py:12
+msgid "Name"
+msgstr "Imię i nazwisko na listę darczyńców"
+
+#: forms.py:13
+msgid "Optional name for public list of contributors"
+msgstr "Opcjonalnie imię i nazwisko lub pseudonim do listy darczyńców."
+
+#: forms.py:14
+msgid "Contact e-mail"
+msgstr "E-mail kontaktowy"
+
+#: forms.py:15
+msgid ""
+"We'll use it to contact you about your perks and fundraiser status and "
+"payment updates.<br/> Won't be publicised."
+msgstr ""
+"Użyjemy go do kontaktu w sprawie prezentów i informacji o zmianach statusu "
+"zbiórki i kolejnych akcjach.<br/>Nie będzie publikowany."
+
+#: models.py:19
+msgid "author"
+msgstr "autor"
+
+#: models.py:20
+msgid "title"
+msgstr "tytuł"
+
+#: models.py:21
+msgid "slug"
+msgstr "slug"
+
+#: models.py:22 models.py:117
+msgid "description"
+msgstr "opis"
+
+#: models.py:23
+msgid "target"
+msgstr "kwota docelowa"
+
+#: models.py:24
+msgid "start"
+msgstr "początek"
+
+#: models.py:25
+msgid "end"
+msgstr "koniec"
+
+#: models.py:26
+msgid "due"
+msgstr "data publikacji"
+
+#: models.py:27
+msgid "When will it be published if the money is raised."
+msgstr "Kiedy książka zostanie opublikowana, jeśli uda się zebrać pieniądze."
+
+#: models.py:28
+msgid "redakcja URL"
+msgstr "URL na Redakcji"
+
+#: models.py:30
+msgid "Published book."
+msgstr "Opublikowana książka."
+
+#: models.py:31
+msgid "Cover"
+msgstr "Okładka"
+
+#: models.py:32
+msgid "Poll"
+msgstr "Ankieta"
+
+#: models.py:36
+msgid "Cover preview"
+msgstr "Podgląd okładki"
+
+#: models.py:40 models.py:114 models.py:135
+msgid "offer"
+msgstr "zbiórka"
+
+#: models.py:41
+msgid "offers"
+msgstr "zbiórki"
+
+#: models.py:115
+msgid "price"
+msgstr "cena"
+
+#: models.py:116 models.py:136
+msgid "name"
+msgstr "nazwa"
+
+#: models.py:118
+msgid "end date"
+msgstr "data końcowa"
+
+#: models.py:121
+msgid "perk"
+msgstr "prezent"
+
+#: models.py:122 models.py:140
+msgid "perks"
+msgstr "prezenty"
+
+#: models.py:137
+msgid "email"
+msgstr "e-mail"
+
+#: models.py:138 models.py:167
+msgid "amount"
+msgstr "kwota"
+
+#: models.py:139
+msgid "payed at"
+msgstr "data wpłaty"
+
+#: models.py:150
+msgid "funding"
+msgstr "wpłata"
+
+#: models.py:151
+msgid "fundings"
+msgstr "wpłaty"
+
+#: models.py:168
+msgid "when"
+msgstr "kiedy"
+
+#: models.py:171
+msgid "money spent on a book"
+msgstr "pieniądze wydane na książkę"
+
+#: models.py:172
+msgid "money spent on books"
+msgstr "pieniądze wydane na książki"
+
+#: models.py:202 templates/funding/thanks.html:6
+#: templates/funding/thanks.html.py:13
+msgid "Thank you for your support!"
+msgstr "Dziękujemy za Twoje wsparcie!"
+
+#: templates/funding/email.txt:3
+msgid "Hi"
+msgstr "Cześć"
+
+#: templates/funding/email.txt:5
+msgid ""
+"Thank you for your support - thanks to you we will set another book free."
+msgstr "Dziękujemy za wsparcie - dzięki Tobie uwolnimy kolejną książkę."
+
+#: templates/funding/email.txt:7
+msgid "The book will be supplemented with your name as a donor."
+msgstr ""
+"Twoje imię i nazwisko lub pseudonim zostaną dodane do listy darczyńców przy "
+"opublikowanej książce."
+
+#: templates/funding/email.txt:9
+msgid ""
+"We will contact you to keep you informed about your perks,\n"
+"status changes to this fundraiser and the incoming ones that we plan to "
+"launch."
+msgstr ""
+"Skontaktujemy się Tobą w sprawie prezentów i informacji o zmianach statusu "
+"zbiórki oraz kolejnych akcjach."
+
+#: templates/funding/email.txt:12
+msgid ""
+"Cheers,\n"
+"Wolne Lektury team"
+msgstr ""
+"Pozdrawiamy,\n"
+"zespół Wolnych Lektur"
+
+#: templates/funding/no_thanks.html:5 templates/funding/no_thanks.html.py:9
+msgid "Payment failed"
+msgstr "Płatność nie doszła do skutku"
+
+#: templates/funding/no_thanks.html:12
+msgid "You're support has not been processed successfully."
+msgstr "Twoje wsparcie nie zostało zaksięgowane."
+
+#: templates/funding/no_thanks.html:16
+#, python-format
+msgid ""
+"Return to the <a href=\"%(current)s\">current fundraiser</a> and try again "
+"or try to use a different payment method."
+msgstr ""
+"Wróć do <a href=\"%(current)s\">aktualnej zbiórki</a> i spróbuj ponownie lub "
+"użyj innej metody płatności."
+
+#: templates/funding/offer_detail.html:32 templates/funding/offer_list.html:29
+#: templates/funding/tags/funding.html:20
+#: templates/funding/tags/funding.html:46
+msgid "Help free the book!"
+msgstr "Pomóż uwolnić książkę!"
+
+#: templates/funding/offer_detail.html:36 templates/funding/thanks.html:29
+#: templates/funding/wlfund.html:17 templates/funding/tags/funding.html:12
+msgid "Learn more"
+msgstr "Dowiedz się więcej"
+
+#: templates/funding/offer_detail.html:44
+msgid "Support the publication"
+msgstr "Wesprzyj publikację"
+
+#: templates/funding/offer_detail.html:51
+msgid "Donate!"
+msgstr "Wpłać!"
+
+#: templates/funding/offer_detail.html:59 templates/funding/thanks.html:35
+msgid "Tell your friends!"
+msgstr "Powiedz swoim znajomym!"
+
+#: templates/funding/offer_detail.html:60
+msgid "Support Wolne Lektury!"
+msgstr "Wesprzyj Wolne Lektury!"
+
+#: templates/funding/offer_detail.html:63
+msgid "See all fundraisers."
+msgstr "Zobacz wszystkie zbiórki."
+
+#: templates/funding/offer_detail.html:68
+msgid "Supporters"
+msgstr "Wpłaty"
+
+#: templates/funding/offer_detail.html:82
+msgid "Anonymous"
+msgstr "Anonim"
+
+#: templates/funding/offer_list.html:7 templates/funding/offer_list.html:12
+msgid "All fundraisers"
+msgstr "Wszystkie zbiórki"
+
+#: templates/funding/offer_list.html:20
+msgid "Current fundraiser:"
+msgstr "Aktualna zbiórka:"
+
+#: templates/funding/offer_list.html:22 templates/funding/offer_list.html:37
+msgid "Previous fundraisers:"
+msgstr "Poprzednie zbiórki:"
+
+#: templates/funding/thanks.html:10
+msgid "Thank you!"
+msgstr "Dziękujemy!"
+
+#: templates/funding/thanks.html:16
+#: templates/funding/tags/offer_status.html:22
+msgid "Full amount was successfully raised!"
+msgstr "Udało się zebrać pełną kwotę!"
+
+#: templates/funding/thanks.html:18 templates/funding/tags/offer_status.html:6
+#, python-format
+msgid ""
+"The fundraiser\n"
+"            ends on %(end)s. The book will be published by %(due)s."
+msgstr "Zbiórka kończy się %(end)s. Książka zostanie opublikowana do %(due)s."
+
+#: templates/funding/thanks.html:22
+#, python-format
+msgid ""
+"Your donation will be spent on digitizing, compiling and\n"
+"        publishing the book %(b)s in multiple formats. We will contact you "
+"if you qualify for perks."
+msgstr ""
+"Pieniądze przez Ciebie  wpłacone przeznaczymy na digitalizację, opracowanie "
+"i udostępnienie książki %(b)s w serwisie w wielu formatach. Jeśli wybrałeś "
+"nagrody, skontaktujemy się z Tobą mailowo."
+
+#: templates/funding/thanks.html:32
+msgid "Go back to the current fundraiser."
+msgstr "Wróć do aktualnej zbiórki."
+
+#: templates/funding/thanks.html:36
+msgid "I support Wolne Lektury."
+msgstr "Wspieram Wolne Lektury"
+
+#: templates/funding/thanks.html:39
+msgid "Vote for a book for the next fundraiser"
+msgstr "Pomóż wybrać następną książkę, na którą będziemy zbierać pieniądze"
+
+#: templates/funding/wlfund.html:4 templates/funding/wlfund.html.py:8
+msgid "Remaining funds"
+msgstr "Pozostałe środki"
+
+#: templates/funding/wlfund.html:11
+#, python-format
+msgid ""
+"If\n"
+"the full amount needed for publishing a book is not raised in time,\n"
+"the funds are spent on <a href=\"%(r)s\">other books waiting for\n"
+"publication</a>. The same thing happens with any money remaining\n"
+"from successful fundraisers."
+msgstr ""
+"Jeśli nie udało się zebrać pełnej kwoty potrzebnej do opublikowania książki, "
+"środki przekazujemy na redakcję <a href=\"%(r)s\">innych utworów "
+"oczekujących na publikację w serwisie</a>. Na ten cel przekazujemy również "
+"nadmiarowe środki ze zbiórek ukończonych sukcesem."
+
+#: templates/funding/wlfund.html:19
+msgid "Spending these remaining funds is recorded in this table."
+msgstr "W poniższej tabeli rejetrujemy wydatkowanie tych środków."
+
+#: templates/funding/wlfund.html:26
+msgid "Date"
+msgstr "Data"
+
+#: templates/funding/wlfund.html:27
+msgid "Operation"
+msgstr "Rozdysponowanie środków"
+
+#: templates/funding/wlfund.html:29
+msgid "Balance"
+msgstr "Bilans"
+
+#: templates/funding/wlfund.html:36
+msgid "Money spent on publishing the book"
+msgstr "Pieniądze przeznaczone na opublikowanie książki"
+
+#: templates/funding/wlfund.html:45
+msgid "Money remaining from the fundraiser for"
+msgstr "Pieniądze pozostałe ze zbiórki na"
+
+#: templates/funding/snippets/any_remaining.html:4
+#, python-format
+msgid ""
+"Any <a href=\"%(wlfund)s\">remaining funds</a> will be spent\n"
+"on other books waiting to be published."
+msgstr ""
+"Wszelkie <a href=\"%(wlfund)s\">pozostałe środki</a> przeznaczymy na inne "
+"książki czekające na publikację."
+
+#: templates/funding/snippets/any_remaining.html:7
+msgid ""
+"We will supplement every book with your name as a donor, no matter how\n"
+"big your support will be."
+msgstr ""
+"Zostaniesz umieszczony na liście darczyńców, niezależnie od wysokości wpłaty."
+
+#: templates/funding/tags/funding.html:10
+msgid "Support!"
+msgstr "Wesprzyj!"
+
+#: templates/funding/tags/funding.html:28
+msgid "collected"
+msgstr "zebrane"
+
+#: templates/funding/tags/funding.html:31
+msgid "needed"
+msgstr "potrzebujemy"
+
+#: templates/funding/tags/funding.html:34
+msgid "until fundraiser end"
+msgstr "do końca zbiórki"
+
+#: templates/funding/tags/offer_status.html:11
+#, python-format
+msgid ""
+"W need %(target)s zł to digitize it,\n"
+"        compile it and publish for free in multiple formats."
+msgstr ""
+"Potrzebujemy %(target)s zł, by ją zdigitalizować, opracować i bezpłatnie "
+"udostępnić w serwisie w wielu formatach."
+
+#: templates/funding/tags/offer_status.html:15
+#, python-format
+msgid ""
+"If we raise enought money before %(end)s we will\n"
+"        publish it and make it available for everyone."
+msgstr ""
+"Jeśli do %(end)s uda się zebrać pełną kwotę, opublikujemy ją i będzie "
+"dostępna dla wszystkich."
+
+#: templates/funding/tags/offer_status.html:26
+msgid "The amount needed was not raised."
+msgstr "Nie udało się zebrać pełnej kwoty."
+
+#: templates/funding/tags/offer_status_more.html:8
+msgid "Fundraiser span"
+msgstr "Termin zbiórki"
+
+#: templates/funding/tags/offer_status_more.html:12
+#, python-format
+msgid ""
+"The book\n"
+"                <a href=\"%(bu)s\">%(bt)s</a> has been already published."
+msgstr ""
+"Książka\n"
+"                <a href=\"%(bu)s\">%(bt)s</a> została opublikowana."
+
+#: templates/funding/tags/offer_status_more.html:15
+#, python-format
+msgid ""
+"The book\n"
+"                will be published by %(due)s."
+msgstr "Książka zostanie opublikowana do %(due)s."
+
+#: templates/funding/tags/offer_status_more.html:18
+#, python-format
+msgid ""
+"You can follow\n"
+"                    the work on the <a href=\"%(r)s\">Editorial Platform</a>."
+msgstr "Możesz śledzić prace na <a href=\"%(r)s\">Platformie Redakcyjnej</a>."
+
+#: templates/funding/widgets/amount.html:13
+msgid "Other amount"
+msgstr "Inna kwota"
diff --git a/apps/funding/migrations/0001_initial.py b/apps/funding/migrations/0001_initial.py
new file mode 100644 (file)
index 0000000..924ef77
--- /dev/null
@@ -0,0 +1,102 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding model 'Offer'
+        db.create_table('funding_offer', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('author', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('title', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50)),
+            ('book_url', self.gf('django.db.models.fields.URLField')(max_length=200, blank=True)),
+            ('redakcja_url', self.gf('django.db.models.fields.URLField')(max_length=200, blank=True)),
+            ('target', self.gf('django.db.models.fields.DecimalField')(max_digits=10, decimal_places=2)),
+            ('start', self.gf('django.db.models.fields.DateField')()),
+            ('end', self.gf('django.db.models.fields.DateField')()),
+        ))
+        db.send_create_signal('funding', ['Offer'])
+
+        # Adding model 'Perk'
+        db.create_table('funding_perk', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('offer', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['funding.Offer'], null=True)),
+            ('price', self.gf('django.db.models.fields.DecimalField')(max_digits=10, decimal_places=2)),
+            ('name', self.gf('django.db.models.fields.CharField')(max_length=255)),
+            ('description', self.gf('django.db.models.fields.TextField')(blank=True)),
+        ))
+        db.send_create_signal('funding', ['Perk'])
+
+        # Adding model 'Funding'
+        db.create_table('funding_funding', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('offer', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['funding.Offer'])),
+            ('name', self.gf('django.db.models.fields.CharField')(max_length=127)),
+            ('email', self.gf('django.db.models.fields.EmailField')(max_length=75)),
+            ('amount', self.gf('django.db.models.fields.DecimalField')(max_digits=10, decimal_places=2)),
+            ('payed_at', self.gf('django.db.models.fields.DateTimeField')()),
+        ))
+        db.send_create_signal('funding', ['Funding'])
+
+        # Adding M2M table for field perks on 'Funding'
+        db.create_table('funding_funding_perks', (
+            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
+            ('funding', models.ForeignKey(orm['funding.funding'], null=False)),
+            ('perk', models.ForeignKey(orm['funding.perk'], null=False))
+        ))
+        db.create_unique('funding_funding_perks', ['funding_id', 'perk_id'])
+
+
+    def backwards(self, orm):
+        # Deleting model 'Offer'
+        db.delete_table('funding_offer')
+
+        # Deleting model 'Perk'
+        db.delete_table('funding_perk')
+
+        # Deleting model 'Funding'
+        db.delete_table('funding_funding')
+
+        # Removing M2M table for field perks on 'Funding'
+        db.delete_table('funding_funding_perks')
+
+
+    models = {
+        'funding.funding': {
+            'Meta': {'ordering': "['-payed_at']", 'object_name': 'Funding'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '127'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['funding.Offer']"}),
+            'payed_at': ('django.db.models.fields.DateTimeField', [], {}),
+            'perks': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['funding.Perk']", 'symmetrical': 'False'})
+        },
+        'funding.offer': {
+            'Meta': {'ordering': "['-end']", 'object_name': 'Offer'},
+            'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'book_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'end': ('django.db.models.fields.DateField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'redakcja_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
+            'start': ('django.db.models.fields.DateField', [], {}),
+            'target': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        'funding.perk': {
+            'Meta': {'ordering': "['-price']", 'object_name': 'Perk'},
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['funding.Offer']", 'null': 'True'}),
+            'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'})
+        }
+    }
+
+    complete_apps = ['funding']
\ No newline at end of file
diff --git a/apps/funding/migrations/0002_auto__add_spent__del_field_offer_book_url__add_field_offer_book.py b/apps/funding/migrations/0002_auto__add_spent__del_field_offer_book_url__add_field_offer_book.py
new file mode 100644 (file)
index 0000000..1c03bdb
--- /dev/null
@@ -0,0 +1,108 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding model 'Spent'
+        db.create_table('funding_spent', (
+            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('amount', self.gf('django.db.models.fields.DecimalField')(max_digits=10, decimal_places=2)),
+            ('timestamp', self.gf('django.db.models.fields.DateField')()),
+            ('book', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.Book'])),
+        ))
+        db.send_create_signal('funding', ['Spent'])
+
+        # Deleting field 'Offer.book_url'
+        db.delete_column('funding_offer', 'book_url')
+
+        # Adding field 'Offer.book'
+        db.add_column('funding_offer', 'book',
+                      self.gf('django.db.models.fields.related.ForeignKey')(to=orm['catalogue.Book'], null=True, blank=True),
+                      keep_default=False)
+
+
+    def backwards(self, orm):
+        # Deleting model 'Spent'
+        db.delete_table('funding_spent')
+
+        # Adding field 'Offer.book_url'
+        db.add_column('funding_offer', 'book_url',
+                      self.gf('django.db.models.fields.URLField')(default='', max_length=200, blank=True),
+                      keep_default=False)
+
+        # Deleting field 'Offer.book'
+        db.delete_column('funding_offer', 'book_id')
+
+
+    models = {
+        'catalogue.book': {
+            'Meta': {'ordering': "('sort_key',)", 'object_name': 'Book'},
+            '_related_info': ('jsonfield.fields.JSONField', [], {'null': 'True', 'blank': 'True'}),
+            'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'common_slug': ('django.db.models.fields.SlugField', [], {'max_length': '120'}),
+            'cover': ('catalogue.fields.EbookField', [], {'max_length': '100', 'null': 'True', 'format_name': "'cover'", 'blank': 'True'}),
+            'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'epub_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'epub'", 'blank': 'True'}),
+            'extra_info': ('jsonfield.fields.JSONField', [], {'default': "'{}'"}),
+            'fb2_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'fb2'", 'blank': 'True'}),
+            'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'html_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'html'", 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'language': ('django.db.models.fields.CharField', [], {'default': "'pol'", 'max_length': '3', 'db_index': 'True'}),
+            'mobi_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'mobi'", 'blank': 'True'}),
+            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}),
+            'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'pdf_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'pdf'", 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120'}),
+            'sort_key': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
+            'txt_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'txt'", 'blank': 'True'}),
+            'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'xml_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'xml'", 'blank': 'True'})
+        },
+        'funding.funding': {
+            'Meta': {'ordering': "['-payed_at']", 'object_name': 'Funding'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '127'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['funding.Offer']"}),
+            'payed_at': ('django.db.models.fields.DateTimeField', [], {}),
+            'perks': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['funding.Perk']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        'funding.offer': {
+            'Meta': {'ordering': "['-end']", 'object_name': 'Offer'},
+            'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']", 'null': 'True', 'blank': 'True'}),
+            'end': ('django.db.models.fields.DateField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'redakcja_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
+            'start': ('django.db.models.fields.DateField', [], {}),
+            'target': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        'funding.perk': {
+            'Meta': {'ordering': "['-price']", 'object_name': 'Perk'},
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['funding.Offer']", 'null': 'True', 'blank': 'True'}),
+            'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'})
+        },
+        'funding.spent': {
+            'Meta': {'object_name': 'Spent'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'timestamp': ('django.db.models.fields.DateField', [], {})
+        }
+    }
+
+    complete_apps = ['funding']
\ No newline at end of file
diff --git a/apps/funding/migrations/0003_auto__add_field_offer_due.py b/apps/funding/migrations/0003_auto__add_field_offer_due.py
new file mode 100644 (file)
index 0000000..6f9d352
--- /dev/null
@@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding field 'Offer.due'
+        db.add_column('funding_offer', 'due',
+                      self.gf('django.db.models.fields.DateField')(default=datetime.datetime(2013, 3, 27, 0, 0)),
+                      keep_default=False)
+
+
+    def backwards(self, orm):
+        # Deleting field 'Offer.due'
+        db.delete_column('funding_offer', 'due')
+
+
+    models = {
+        'catalogue.book': {
+            'Meta': {'ordering': "('sort_key',)", 'object_name': 'Book'},
+            '_related_info': ('jsonfield.fields.JSONField', [], {'null': 'True', 'blank': 'True'}),
+            'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'common_slug': ('django.db.models.fields.SlugField', [], {'max_length': '120'}),
+            'cover': ('catalogue.fields.EbookField', [], {'max_length': '100', 'null': 'True', 'format_name': "'cover'", 'blank': 'True'}),
+            'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'epub_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'epub'", 'blank': 'True'}),
+            'extra_info': ('jsonfield.fields.JSONField', [], {'default': "'{}'"}),
+            'fb2_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'fb2'", 'blank': 'True'}),
+            'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'html_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'html'", 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'language': ('django.db.models.fields.CharField', [], {'default': "'pol'", 'max_length': '3', 'db_index': 'True'}),
+            'mobi_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'mobi'", 'blank': 'True'}),
+            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}),
+            'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'pdf_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'pdf'", 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120'}),
+            'sort_key': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
+            'txt_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'txt'", 'blank': 'True'}),
+            'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'xml_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'xml'", 'blank': 'True'})
+        },
+        'funding.funding': {
+            'Meta': {'ordering': "['-payed_at']", 'object_name': 'Funding'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '127'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['funding.Offer']"}),
+            'payed_at': ('django.db.models.fields.DateTimeField', [], {}),
+            'perks': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['funding.Perk']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        'funding.offer': {
+            'Meta': {'ordering': "['-end']", 'object_name': 'Offer'},
+            'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']", 'null': 'True', 'blank': 'True'}),
+            'due': ('django.db.models.fields.DateField', [], {}),
+            'end': ('django.db.models.fields.DateField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'redakcja_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
+            'start': ('django.db.models.fields.DateField', [], {}),
+            'target': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        'funding.perk': {
+            'Meta': {'ordering': "['-price']", 'object_name': 'Perk'},
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['funding.Offer']", 'null': 'True', 'blank': 'True'}),
+            'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'})
+        },
+        'funding.spent': {
+            'Meta': {'object_name': 'Spent'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'timestamp': ('django.db.models.fields.DateField', [], {})
+        }
+    }
+
+    complete_apps = ['funding']
\ No newline at end of file
diff --git a/apps/funding/migrations/0004_auto__add_field_funding_anonymous.py b/apps/funding/migrations/0004_auto__add_field_funding_anonymous.py
new file mode 100644 (file)
index 0000000..d8c4faf
--- /dev/null
@@ -0,0 +1,90 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding field 'Funding.anonymous'
+        db.add_column('funding_funding', 'anonymous',
+                      self.gf('django.db.models.fields.BooleanField')(default=False),
+                      keep_default=False)
+
+
+    def backwards(self, orm):
+        # Deleting field 'Funding.anonymous'
+        db.delete_column('funding_funding', 'anonymous')
+
+
+    models = {
+        'catalogue.book': {
+            'Meta': {'ordering': "('sort_key',)", 'object_name': 'Book'},
+            '_related_info': ('jsonfield.fields.JSONField', [], {'null': 'True', 'blank': 'True'}),
+            'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'common_slug': ('django.db.models.fields.SlugField', [], {'max_length': '120'}),
+            'cover': ('catalogue.fields.EbookField', [], {'max_length': '100', 'null': 'True', 'format_name': "'cover'", 'blank': 'True'}),
+            'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'epub_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'epub'", 'blank': 'True'}),
+            'extra_info': ('jsonfield.fields.JSONField', [], {'default': "'{}'"}),
+            'fb2_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'fb2'", 'blank': 'True'}),
+            'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'html_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'html'", 'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'language': ('django.db.models.fields.CharField', [], {'default': "'pol'", 'max_length': '3', 'db_index': 'True'}),
+            'mobi_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'mobi'", 'blank': 'True'}),
+            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}),
+            'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'pdf_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'pdf'", 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120'}),
+            'sort_key': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
+            'txt_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'txt'", 'blank': 'True'}),
+            'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'xml_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'xml'", 'blank': 'True'})
+        },
+        'funding.funding': {
+            'Meta': {'ordering': "['-payed_at']", 'object_name': 'Funding'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'anonymous': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '127'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['funding.Offer']"}),
+            'payed_at': ('django.db.models.fields.DateTimeField', [], {}),
+            'perks': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['funding.Perk']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        'funding.offer': {
+            'Meta': {'ordering': "['-end']", 'object_name': 'Offer'},
+            'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']", 'null': 'True', 'blank': 'True'}),
+            'due': ('django.db.models.fields.DateField', [], {}),
+            'end': ('django.db.models.fields.DateField', [], {}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'redakcja_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
+            'start': ('django.db.models.fields.DateField', [], {}),
+            'target': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        'funding.perk': {
+            'Meta': {'ordering': "['-price']", 'object_name': 'Perk'},
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['funding.Offer']", 'null': 'True', 'blank': 'True'}),
+            'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'})
+        },
+        'funding.spent': {
+            'Meta': {'object_name': 'Spent'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}),
+            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'timestamp': ('django.db.models.fields.DateField', [], {})
+        }
+    }
+
+    complete_apps = ['funding']
\ No newline at end of file
diff --git a/apps/funding/migrations/0005_auto__chg_field_funding_payed_at.py b/apps/funding/migrations/0005_auto__chg_field_funding_payed_at.py
new file mode 100644 (file)
index 0000000..bcd4e1e
--- /dev/null
@@ -0,0 +1,88 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+
+        # Changing field 'Funding.payed_at'
+        db.alter_column(u'funding_funding', 'payed_at', self.gf('django.db.models.fields.DateTimeField')(null=True))
+
+    def backwards(self, orm):
+
+        # Changing field 'Funding.payed_at'
+        db.alter_column(u'funding_funding', 'payed_at', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2013, 4, 16, 0, 0)))
+
+    models = {
+        'catalogue.book': {
+            'Meta': {'ordering': "('sort_key',)", 'object_name': 'Book'},
+            '_related_info': ('jsonfield.fields.JSONField', [], {'null': 'True', 'blank': 'True'}),
+            'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'common_slug': ('django.db.models.fields.SlugField', [], {'max_length': '120'}),
+            'cover': ('catalogue.fields.EbookField', [], {'max_length': '100', 'null': 'True', 'format_name': "'cover'", 'blank': 'True'}),
+            'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'epub_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'epub'", 'blank': 'True'}),
+            'extra_info': ('jsonfield.fields.JSONField', [], {'default': "'{}'"}),
+            'fb2_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'fb2'", 'blank': 'True'}),
+            'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'html_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'html'", 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'language': ('django.db.models.fields.CharField', [], {'default': "'pol'", 'max_length': '3', 'db_index': 'True'}),
+            'mobi_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'mobi'", 'blank': 'True'}),
+            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}),
+            'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'pdf_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'pdf'", 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120'}),
+            'sort_key': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
+            'txt_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'txt'", 'blank': 'True'}),
+            'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'xml_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'xml'", 'blank': 'True'})
+        },
+        u'funding.funding': {
+            'Meta': {'ordering': "['-payed_at']", 'object_name': 'Funding'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'anonymous': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '127', 'blank': 'True'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']"}),
+            'payed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'perks': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['funding.Perk']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        u'funding.offer': {
+            'Meta': {'ordering': "['-end']", 'object_name': 'Offer'},
+            'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']", 'null': 'True', 'blank': 'True'}),
+            'due': ('django.db.models.fields.DateField', [], {}),
+            'end': ('django.db.models.fields.DateField', [], {}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'redakcja_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
+            'start': ('django.db.models.fields.DateField', [], {}),
+            'target': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        u'funding.perk': {
+            'Meta': {'ordering': "['-price']", 'object_name': 'Perk'},
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']", 'null': 'True', 'blank': 'True'}),
+            'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'})
+        },
+        u'funding.spent': {
+            'Meta': {'ordering': "['-timestamp']", 'object_name': 'Spent'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'timestamp': ('django.db.models.fields.DateField', [], {})
+        }
+    }
+
+    complete_apps = ['funding']
\ No newline at end of file
diff --git a/apps/funding/migrations/0006_auto__del_field_funding_anonymous.py b/apps/funding/migrations/0006_auto__del_field_funding_anonymous.py
new file mode 100644 (file)
index 0000000..9a059a4
--- /dev/null
@@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Deleting field 'Funding.anonymous'
+        db.delete_column(u'funding_funding', 'anonymous')
+
+
+    def backwards(self, orm):
+        # Adding field 'Funding.anonymous'
+        db.add_column(u'funding_funding', 'anonymous',
+                      self.gf('django.db.models.fields.BooleanField')(default=False),
+                      keep_default=False)
+
+
+    models = {
+        'catalogue.book': {
+            'Meta': {'ordering': "('sort_key',)", 'object_name': 'Book'},
+            '_related_info': ('jsonfield.fields.JSONField', [], {'null': 'True', 'blank': 'True'}),
+            'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'common_slug': ('django.db.models.fields.SlugField', [], {'max_length': '120'}),
+            'cover': ('catalogue.fields.EbookField', [], {'max_length': '100', 'null': 'True', 'format_name': "'cover'", 'blank': 'True'}),
+            'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'epub_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'epub'", 'blank': 'True'}),
+            'extra_info': ('jsonfield.fields.JSONField', [], {'default': "'{}'"}),
+            'fb2_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'fb2'", 'blank': 'True'}),
+            'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'html_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'html'", 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'language': ('django.db.models.fields.CharField', [], {'default': "'pol'", 'max_length': '3', 'db_index': 'True'}),
+            'mobi_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'mobi'", 'blank': 'True'}),
+            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}),
+            'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'pdf_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'pdf'", 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120'}),
+            'sort_key': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
+            'txt_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'txt'", 'blank': 'True'}),
+            'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'xml_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'xml'", 'blank': 'True'})
+        },
+        u'funding.funding': {
+            'Meta': {'ordering': "['-payed_at']", 'object_name': 'Funding'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '127', 'blank': 'True'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']"}),
+            'payed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'perks': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['funding.Perk']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        u'funding.offer': {
+            'Meta': {'ordering': "['-end']", 'object_name': 'Offer'},
+            'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']", 'null': 'True', 'blank': 'True'}),
+            'due': ('django.db.models.fields.DateField', [], {}),
+            'end': ('django.db.models.fields.DateField', [], {}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'redakcja_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
+            'start': ('django.db.models.fields.DateField', [], {}),
+            'target': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        u'funding.perk': {
+            'Meta': {'ordering': "['-price']", 'object_name': 'Perk'},
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']", 'null': 'True', 'blank': 'True'}),
+            'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'})
+        },
+        u'funding.spent': {
+            'Meta': {'ordering': "['-timestamp']", 'object_name': 'Spent'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'timestamp': ('django.db.models.fields.DateField', [], {})
+        }
+    }
+
+    complete_apps = ['funding']
\ No newline at end of file
diff --git a/apps/funding/migrations/0007_auto__add_field_perk_end_date.py b/apps/funding/migrations/0007_auto__add_field_perk_end_date.py
new file mode 100644 (file)
index 0000000..25f15b2
--- /dev/null
@@ -0,0 +1,90 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding field 'Perk.end_date'
+        db.add_column(u'funding_perk', 'end_date',
+                      self.gf('django.db.models.fields.DateField')(null=True, blank=True),
+                      keep_default=False)
+
+
+    def backwards(self, orm):
+        # Deleting field 'Perk.end_date'
+        db.delete_column(u'funding_perk', 'end_date')
+
+
+    models = {
+        'catalogue.book': {
+            'Meta': {'ordering': "('sort_key',)", 'object_name': 'Book'},
+            '_related_info': ('jsonfield.fields.JSONField', [], {'null': 'True', 'blank': 'True'}),
+            'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'common_slug': ('django.db.models.fields.SlugField', [], {'max_length': '120'}),
+            'cover': ('catalogue.fields.EbookField', [], {'max_length': '100', 'null': 'True', 'format_name': "'cover'", 'blank': 'True'}),
+            'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'epub_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'epub'", 'blank': 'True'}),
+            'extra_info': ('jsonfield.fields.JSONField', [], {'default': "'{}'"}),
+            'fb2_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'fb2'", 'blank': 'True'}),
+            'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'html_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'html'", 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'language': ('django.db.models.fields.CharField', [], {'default': "'pol'", 'max_length': '3', 'db_index': 'True'}),
+            'mobi_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'mobi'", 'blank': 'True'}),
+            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}),
+            'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'pdf_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'pdf'", 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120'}),
+            'sort_key': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
+            'txt_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'txt'", 'blank': 'True'}),
+            'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'xml_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'xml'", 'blank': 'True'})
+        },
+        u'funding.funding': {
+            'Meta': {'ordering': "['-payed_at']", 'object_name': 'Funding'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '127', 'blank': 'True'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']"}),
+            'payed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'perks': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['funding.Perk']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        u'funding.offer': {
+            'Meta': {'ordering': "['-end']", 'object_name': 'Offer'},
+            'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']", 'null': 'True', 'blank': 'True'}),
+            'due': ('django.db.models.fields.DateField', [], {}),
+            'end': ('django.db.models.fields.DateField', [], {}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'redakcja_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
+            'start': ('django.db.models.fields.DateField', [], {}),
+            'target': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        u'funding.perk': {
+            'Meta': {'ordering': "['-price']", 'object_name': 'Perk'},
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']", 'null': 'True', 'blank': 'True'}),
+            'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'})
+        },
+        u'funding.spent': {
+            'Meta': {'ordering': "['-timestamp']", 'object_name': 'Spent'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'timestamp': ('django.db.models.fields.DateField', [], {})
+        }
+    }
+
+    complete_apps = ['funding']
\ No newline at end of file
diff --git a/apps/funding/migrations/0008_auto__add_field_offer_description.py b/apps/funding/migrations/0008_auto__add_field_offer_description.py
new file mode 100644 (file)
index 0000000..265df93
--- /dev/null
@@ -0,0 +1,91 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding field 'Offer.description'
+        db.add_column(u'funding_offer', 'description',
+                      self.gf('django.db.models.fields.TextField')(default='', blank=True),
+                      keep_default=False)
+
+
+    def backwards(self, orm):
+        # Deleting field 'Offer.description'
+        db.delete_column(u'funding_offer', 'description')
+
+
+    models = {
+        'catalogue.book': {
+            'Meta': {'ordering': "('sort_key',)", 'object_name': 'Book'},
+            '_related_info': ('jsonfield.fields.JSONField', [], {'null': 'True', 'blank': 'True'}),
+            'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'common_slug': ('django.db.models.fields.SlugField', [], {'max_length': '120'}),
+            'cover': ('catalogue.fields.EbookField', [], {'max_length': '100', 'null': 'True', 'format_name': "'cover'", 'blank': 'True'}),
+            'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'epub_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'epub'", 'blank': 'True'}),
+            'extra_info': ('jsonfield.fields.JSONField', [], {'default': "'{}'"}),
+            'fb2_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'fb2'", 'blank': 'True'}),
+            'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'html_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'html'", 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'language': ('django.db.models.fields.CharField', [], {'default': "'pol'", 'max_length': '3', 'db_index': 'True'}),
+            'mobi_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'mobi'", 'blank': 'True'}),
+            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}),
+            'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'pdf_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'pdf'", 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120'}),
+            'sort_key': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
+            'txt_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'txt'", 'blank': 'True'}),
+            'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'xml_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'xml'", 'blank': 'True'})
+        },
+        u'funding.funding': {
+            'Meta': {'ordering': "['-payed_at']", 'object_name': 'Funding'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '127', 'blank': 'True'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']"}),
+            'payed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'perks': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['funding.Perk']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        u'funding.offer': {
+            'Meta': {'ordering': "['-end']", 'object_name': 'Offer'},
+            'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']", 'null': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'due': ('django.db.models.fields.DateField', [], {}),
+            'end': ('django.db.models.fields.DateField', [], {}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'redakcja_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
+            'start': ('django.db.models.fields.DateField', [], {}),
+            'target': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        u'funding.perk': {
+            'Meta': {'ordering': "['-price']", 'object_name': 'Perk'},
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']", 'null': 'True', 'blank': 'True'}),
+            'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'})
+        },
+        u'funding.spent': {
+            'Meta': {'ordering': "['-timestamp']", 'object_name': 'Spent'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'timestamp': ('django.db.models.fields.DateField', [], {})
+        }
+    }
+
+    complete_apps = ['funding']
\ No newline at end of file
diff --git a/apps/funding/migrations/0009_auto.py b/apps/funding/migrations/0009_auto.py
new file mode 100644 (file)
index 0000000..ae1c415
--- /dev/null
@@ -0,0 +1,95 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding index on 'Offer', fields ['end']
+        db.create_index(u'funding_offer', ['end'])
+
+        # Adding index on 'Offer', fields ['start']
+        db.create_index(u'funding_offer', ['start'])
+
+
+    def backwards(self, orm):
+        # Removing index on 'Offer', fields ['start']
+        db.delete_index(u'funding_offer', ['start'])
+
+        # Removing index on 'Offer', fields ['end']
+        db.delete_index(u'funding_offer', ['end'])
+
+
+    models = {
+        'catalogue.book': {
+            'Meta': {'ordering': "('sort_key',)", 'object_name': 'Book'},
+            '_related_info': ('jsonfield.fields.JSONField', [], {'null': 'True', 'blank': 'True'}),
+            'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'common_slug': ('django.db.models.fields.SlugField', [], {'max_length': '120'}),
+            'cover': ('catalogue.fields.EbookField', [], {'max_length': '100', 'null': 'True', 'format_name': "'cover'", 'blank': 'True'}),
+            'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'epub_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'epub'", 'blank': 'True'}),
+            'extra_info': ('jsonfield.fields.JSONField', [], {'default': "'{}'"}),
+            'fb2_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'fb2'", 'blank': 'True'}),
+            'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'html_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'html'", 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'language': ('django.db.models.fields.CharField', [], {'default': "'pol'", 'max_length': '3', 'db_index': 'True'}),
+            'mobi_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'mobi'", 'blank': 'True'}),
+            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}),
+            'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'pdf_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'pdf'", 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120'}),
+            'sort_key': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
+            'txt_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'txt'", 'blank': 'True'}),
+            'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'xml_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'xml'", 'blank': 'True'})
+        },
+        u'funding.funding': {
+            'Meta': {'ordering': "['-payed_at']", 'object_name': 'Funding'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '127', 'blank': 'True'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']"}),
+            'payed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'perks': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['funding.Perk']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        u'funding.offer': {
+            'Meta': {'ordering': "['-end']", 'object_name': 'Offer'},
+            'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']", 'null': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'due': ('django.db.models.fields.DateField', [], {}),
+            'end': ('django.db.models.fields.DateField', [], {'db_index': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'redakcja_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
+            'start': ('django.db.models.fields.DateField', [], {'db_index': 'True'}),
+            'target': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        u'funding.perk': {
+            'Meta': {'ordering': "['-price']", 'object_name': 'Perk'},
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']", 'null': 'True', 'blank': 'True'}),
+            'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'})
+        },
+        u'funding.spent': {
+            'Meta': {'ordering': "['-timestamp']", 'object_name': 'Spent'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'timestamp': ('django.db.models.fields.DateField', [], {})
+        }
+    }
+
+    complete_apps = ['funding']
\ No newline at end of file
diff --git a/apps/funding/migrations/0010_auto.py b/apps/funding/migrations/0010_auto.py
new file mode 100644 (file)
index 0000000..80d689c
--- /dev/null
@@ -0,0 +1,89 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding index on 'Funding', fields ['payed_at']
+        db.create_index(u'funding_funding', ['payed_at'])
+
+
+    def backwards(self, orm):
+        # Removing index on 'Funding', fields ['payed_at']
+        db.delete_index(u'funding_funding', ['payed_at'])
+
+
+    models = {
+        'catalogue.book': {
+            'Meta': {'ordering': "('sort_key',)", 'object_name': 'Book'},
+            '_related_info': ('jsonfield.fields.JSONField', [], {'null': 'True', 'blank': 'True'}),
+            'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'common_slug': ('django.db.models.fields.SlugField', [], {'max_length': '120'}),
+            'cover': ('catalogue.fields.EbookField', [], {'max_length': '100', 'null': 'True', 'format_name': "'cover'", 'blank': 'True'}),
+            'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'epub_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'epub'", 'blank': 'True'}),
+            'extra_info': ('jsonfield.fields.JSONField', [], {'default': "'{}'"}),
+            'fb2_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'fb2'", 'blank': 'True'}),
+            'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'html_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'html'", 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'language': ('django.db.models.fields.CharField', [], {'default': "'pol'", 'max_length': '3', 'db_index': 'True'}),
+            'mobi_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'mobi'", 'blank': 'True'}),
+            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}),
+            'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'pdf_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'pdf'", 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120'}),
+            'sort_key': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
+            'txt_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'txt'", 'blank': 'True'}),
+            'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'xml_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'xml'", 'blank': 'True'})
+        },
+        u'funding.funding': {
+            'Meta': {'ordering': "['-payed_at']", 'object_name': 'Funding'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '127', 'blank': 'True'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']"}),
+            'payed_at': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+            'perks': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['funding.Perk']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        u'funding.offer': {
+            'Meta': {'ordering': "['-end']", 'object_name': 'Offer'},
+            'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']", 'null': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'due': ('django.db.models.fields.DateField', [], {}),
+            'end': ('django.db.models.fields.DateField', [], {'db_index': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'redakcja_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
+            'start': ('django.db.models.fields.DateField', [], {'db_index': 'True'}),
+            'target': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        u'funding.perk': {
+            'Meta': {'ordering': "['-price']", 'object_name': 'Perk'},
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']", 'null': 'True', 'blank': 'True'}),
+            'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'})
+        },
+        u'funding.spent': {
+            'Meta': {'ordering': "['-timestamp']", 'object_name': 'Spent'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'timestamp': ('django.db.models.fields.DateField', [], {})
+        }
+    }
+
+    complete_apps = ['funding']
\ No newline at end of file
diff --git a/apps/funding/migrations/0011_auto__add_field_offer_cover.py b/apps/funding/migrations/0011_auto__add_field_offer_cover.py
new file mode 100644 (file)
index 0000000..681685d
--- /dev/null
@@ -0,0 +1,92 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding field 'Offer.cover'
+        db.add_column(u'funding_offer', 'cover',
+                      self.gf('django.db.models.fields.files.ImageField')(default=None, max_length=100),
+                      keep_default=False)
+
+
+    def backwards(self, orm):
+        # Deleting field 'Offer.cover'
+        db.delete_column(u'funding_offer', 'cover')
+
+
+    models = {
+        'catalogue.book': {
+            'Meta': {'ordering': "('sort_key',)", 'object_name': 'Book'},
+            '_related_info': ('jsonfield.fields.JSONField', [], {'null': 'True', 'blank': 'True'}),
+            'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'common_slug': ('django.db.models.fields.SlugField', [], {'max_length': '120'}),
+            'cover': ('catalogue.fields.EbookField', [], {'max_length': '100', 'null': 'True', 'format_name': "'cover'", 'blank': 'True'}),
+            'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'epub_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'epub'", 'blank': 'True'}),
+            'extra_info': ('jsonfield.fields.JSONField', [], {'default': "'{}'"}),
+            'fb2_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'fb2'", 'blank': 'True'}),
+            'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'html_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'html'", 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'language': ('django.db.models.fields.CharField', [], {'default': "'pol'", 'max_length': '3', 'db_index': 'True'}),
+            'mobi_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'mobi'", 'blank': 'True'}),
+            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}),
+            'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'pdf_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'pdf'", 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120'}),
+            'sort_key': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
+            'txt_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'txt'", 'blank': 'True'}),
+            'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'xml_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'xml'", 'blank': 'True'})
+        },
+        u'funding.funding': {
+            'Meta': {'ordering': "['-payed_at']", 'object_name': 'Funding'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '127', 'blank': 'True'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']"}),
+            'payed_at': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+            'perks': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['funding.Perk']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        u'funding.offer': {
+            'Meta': {'ordering': "['-end']", 'object_name': 'Offer'},
+            'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']", 'null': 'True', 'blank': 'True'}),
+            'cover': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'due': ('django.db.models.fields.DateField', [], {}),
+            'end': ('django.db.models.fields.DateField', [], {'db_index': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'redakcja_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
+            'start': ('django.db.models.fields.DateField', [], {'db_index': 'True'}),
+            'target': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        u'funding.perk': {
+            'Meta': {'ordering': "['-price']", 'object_name': 'Perk'},
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']", 'null': 'True', 'blank': 'True'}),
+            'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'})
+        },
+        u'funding.spent': {
+            'Meta': {'ordering': "['-timestamp']", 'object_name': 'Spent'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'timestamp': ('django.db.models.fields.DateField', [], {})
+        }
+    }
+
+    complete_apps = ['funding']
\ No newline at end of file
diff --git a/apps/funding/migrations/0012_auto__add_field_offer_poll.py b/apps/funding/migrations/0012_auto__add_field_offer_poll.py
new file mode 100644 (file)
index 0000000..f824e8a
--- /dev/null
@@ -0,0 +1,100 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding field 'Offer.poll'
+        db.add_column(u'funding_offer', 'poll',
+                      self.gf('django.db.models.fields.related.ForeignKey')(to=orm['polls.Poll'], null=True, on_delete=models.SET_NULL),
+                      keep_default=False)
+
+
+    def backwards(self, orm):
+        # Deleting field 'Offer.poll'
+        db.delete_column(u'funding_offer', 'poll_id')
+
+
+    models = {
+        'catalogue.book': {
+            'Meta': {'ordering': "('sort_key',)", 'object_name': 'Book'},
+            '_related_info': ('jsonfield.fields.JSONField', [], {'null': 'True', 'blank': 'True'}),
+            'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'common_slug': ('django.db.models.fields.SlugField', [], {'max_length': '120'}),
+            'cover': ('catalogue.fields.EbookField', [], {'max_length': '100', 'null': 'True', 'format_name': "'cover'", 'blank': 'True'}),
+            'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'epub_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'epub'", 'blank': 'True'}),
+            'extra_info': ('jsonfield.fields.JSONField', [], {'default': "'{}'"}),
+            'fb2_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'fb2'", 'blank': 'True'}),
+            'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'html_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'html'", 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'language': ('django.db.models.fields.CharField', [], {'default': "'pol'", 'max_length': '3', 'db_index': 'True'}),
+            'mobi_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'mobi'", 'blank': 'True'}),
+            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}),
+            'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'pdf_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'pdf'", 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120'}),
+            'sort_key': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
+            'txt_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'txt'", 'blank': 'True'}),
+            'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'xml_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'xml'", 'blank': 'True'})
+        },
+        u'funding.funding': {
+            'Meta': {'ordering': "['-payed_at']", 'object_name': 'Funding'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '127', 'blank': 'True'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']"}),
+            'payed_at': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}),
+            'perks': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['funding.Perk']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        u'funding.offer': {
+            'Meta': {'ordering': "['-end']", 'object_name': 'Offer'},
+            'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']", 'null': 'True', 'blank': 'True'}),
+            'cover': ('django.db.models.fields.files.ImageField', [], {'max_length': '100'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'due': ('django.db.models.fields.DateField', [], {}),
+            'end': ('django.db.models.fields.DateField', [], {'db_index': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'poll': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['polls.Poll']", 'null': 'True', 'on_delete': 'models.SET_NULL'}),
+            'redakcja_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
+            'start': ('django.db.models.fields.DateField', [], {'db_index': 'True'}),
+            'target': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        u'funding.perk': {
+            'Meta': {'ordering': "['-price']", 'object_name': 'Perk'},
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']", 'null': 'True', 'blank': 'True'}),
+            'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'})
+        },
+        u'funding.spent': {
+            'Meta': {'ordering': "['-timestamp']", 'object_name': 'Spent'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']"}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'timestamp': ('django.db.models.fields.DateField', [], {})
+        },
+        u'polls.poll': {
+            'Meta': {'object_name': 'Poll'},
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'open': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'question': ('django.db.models.fields.TextField', [], {}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'})
+        }
+    }
+
+    complete_apps = ['funding']
\ No newline at end of file
diff --git a/apps/funding/migrations/__init__.py b/apps/funding/migrations/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/apps/funding/models.py b/apps/funding/models.py
new file mode 100644 (file)
index 0000000..0e05e1d
--- /dev/null
@@ -0,0 +1,207 @@
+# -*- 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.
+#
+from datetime import date, datetime
+from django.core.urlresolvers import reverse
+from django.core.mail import send_mail
+from django.conf import settings
+from django.template.loader import render_to_string
+from django.db import models
+from django.utils.translation import ugettext_lazy as _, ugettext as __
+import getpaid
+from catalogue.models import Book
+from polls.models import Poll
+
+
+class Offer(models.Model):
+    """ A fundraiser for a particular book. """
+    author = models.CharField(_('author'), max_length=255)
+    title = models.CharField(_('title'), max_length=255)
+    slug = models.SlugField(_('slug'))
+    description = models.TextField(_('description'), blank=True)
+    target = models.DecimalField(_('target'), decimal_places=2, max_digits=10)
+    start = models.DateField(_('start'), db_index=True)
+    end = models.DateField(_('end'), db_index=True)
+    due = models.DateField(_('due'),
+        help_text=_('When will it be published if the money is raised.'))
+    redakcja_url = models.URLField(_('redakcja URL'), blank=True)
+    book = models.ForeignKey(Book, null=True, blank=True,
+        help_text=_('Published book.'))
+    cover = models.ImageField(_('Cover'), upload_to = 'funding/covers')
+    poll = models.ForeignKey(Poll, help_text = _('Poll'),  null = True, on_delete = models.SET_NULL)
+        
+    def cover_img_tag(self):
+        return u'<img src="%s" />' % self.cover.url
+    cover_img_tag.short_description = _('Cover preview')
+    cover_img_tag.allow_tags = True
+        
+    class Meta:
+        verbose_name = _('offer')
+        verbose_name_plural = _('offers')
+        ordering = ['-end']
+
+    def __unicode__(self):
+        return u"%s - %s" % (self.author, self.title)
+
+    def get_absolute_url(self):
+        return reverse('funding_offer', args=[self.slug])
+
+    def is_current(self):
+        return self.start <= date.today() <= self.end
+
+    def is_win(self):
+        return self.sum() >= self.target
+
+    def remaining(self):
+        if self.is_current():
+            return None
+        if self.is_win():
+            return self.sum() - self.target
+        else:
+            return self.sum()
+
+    @classmethod
+    def current(cls):
+        """ Returns current fundraiser or None. """
+        today = date.today()
+        objects = cls.objects.filter(start__lte=today, end__gte=today)
+        try:
+            return objects[0]
+        except IndexError:
+            return None
+
+    @classmethod
+    def past(cls):
+        """ QuerySet for all current and past fundraisers. """
+        today = date.today()
+        return cls.objects.filter(end__lt=today)
+
+    @classmethod
+    def public(cls):
+        """ QuerySet for all current and past fundraisers. """
+        today = date.today()
+        return cls.objects.filter(start__lte=today)
+
+    def get_perks(self, amount=None):
+        """ Finds all the perks for the offer.
+        
+        If amount is provided, returns the perks you get for it.
+
+        """
+        perks = Perk.objects.filter(
+                models.Q(offer=self) | models.Q(offer=None)
+            ).exclude(end_date__lt=date.today())
+        if amount is not None:
+            perks = perks.filter(price__lte=amount)
+        return perks
+
+    def funding_payed(self):
+        """ QuerySet for all completed payments for the offer. """
+        return Funding.payed().filter(offer=self)
+
+    def sum(self):
+        """ The money gathered. """
+        return self.funding_payed().aggregate(s=models.Sum('amount'))['s'] or 0
+
+
+class Perk(models.Model):
+    """ A perk offer.
+    
+    If no attached to a particular Offer, applies to all.
+
+    """
+    offer = models.ForeignKey(Offer, verbose_name=_('offer'), null=True, blank=True)
+    price = models.DecimalField(_('price'), decimal_places=2, max_digits=10)
+    name = models.CharField(_('name'), max_length=255)
+    description = models.TextField(_('description'), blank=True)
+    end_date = models.DateField(_('end date'), null=True, blank=True)
+
+    class Meta:
+        verbose_name = _('perk')
+        verbose_name_plural = _('perks')
+        ordering = ['-price']
+
+    def __unicode__(self):
+        return "%s (%s%s)" % (self.name, self.price, u" for %s" % self.offer if self.offer else "")
+
+
+class Funding(models.Model):
+    """ A person paying in a fundraiser.
+
+    The payment was completed if and only if payed_at is set.
+
+    """
+    offer = models.ForeignKey(Offer, verbose_name=_('offer'))
+    name = models.CharField(_('name'), max_length=127, blank=True)
+    email = models.EmailField(_('email'), blank=True)
+    amount = models.DecimalField(_('amount'), decimal_places=2, max_digits=10)
+    payed_at = models.DateTimeField(_('payed at'), null=True, blank=True, db_index=True)
+    perks = models.ManyToManyField(Perk, verbose_name=_('perks'), blank=True)
+
+    # Any additional info needed for perks?
+
+    @classmethod
+    def payed(cls):
+        """ QuerySet for all completed payments. """
+        return cls.objects.exclude(payed_at=None)
+
+    class Meta:
+        verbose_name = _('funding')
+        verbose_name_plural = _('fundings')
+        ordering = ['-payed_at']
+
+    def __unicode__(self):
+        return unicode(self.offer)
+
+    def get_absolute_url(self):
+        return reverse('funding_funding', args=[self.pk])
+
+# Register the Funding model with django-getpaid for payments.
+getpaid.register_to_payment(Funding, unique=False, related_name='payment')
+
+
+class Spent(models.Model):
+    """ Some of the remaining money spent on a book. """
+    book = models.ForeignKey(Book)
+    amount = models.DecimalField(_('amount'), decimal_places=2, max_digits=10)
+    timestamp = models.DateField(_('when'))
+
+    class Meta:
+        verbose_name = _('money spent on a book')
+        verbose_name_plural = _('money spent on books')
+        ordering = ['-timestamp']
+
+    def __unicode__(self):
+        return u"Spent: %s" % unicode(self.book)
+
+
+def new_payment_query_listener(sender, order=None, payment=None, **kwargs):
+    """ Set payment details for getpaid. """
+    payment.amount = order.amount
+    payment.currency = 'PLN'
+getpaid.signals.new_payment_query.connect(new_payment_query_listener)
+
+
+def user_data_query_listener(sender, order, user_data, **kwargs):
+    """ Set user data for payment. """
+    user_data['email'] = order.email
+getpaid.signals.user_data_query.connect(user_data_query_listener)
+
+def payment_status_changed_listener(sender, instance, old_status, new_status, **kwargs):
+    """ React to status changes from getpaid. """
+    if old_status != 'paid' and new_status == 'paid':
+        instance.order.payed_at = datetime.now()
+        instance.order.save()
+        if instance.order.email:
+            send_thank_you_email(instance.order.name, instance.order.email)
+getpaid.signals.payment_status_changed.connect(payment_status_changed_listener)
+
+def send_thank_you_email(name, address):
+    send_mail(_('Thank you for your support!'), 
+            render_to_string('funding/email.txt', dict(name = name)),
+            getattr(settings, 'CONTACT_EMAIL', 'wolnelektury@nowoczesnapolska.org.pl'),
+            [address],
+            fail_silently=False
+            )
diff --git a/apps/funding/static/funding/funding.css b/apps/funding/static/funding/funding.css
new file mode 100755 (executable)
index 0000000..c9514ff
--- /dev/null
@@ -0,0 +1 @@
+.funding{background:orange;margin:auto;padding:5px 0;position:relative}.funding a.call{height:1.2em;width:9em;padding:.35em .5em;margin:.5em;display:inline-block;vertical-align:top;text-align:center;background:rgb(.465%, 59.936%, 63.653%)}.funding .description{display:inline-block;padding-left:.6em}.funding .description a{display:block;color:#000;padding:0 3px}.funding strong{font-size:1.5em;padding:.2em 0 0}.funding .progress{width:95.7em;margin:.3em 0 .4em;border-radius:2em;background-image:url(/static/img/progress-pixel.png);background-repeat:repeat-y;background-color:rgba(236, 109, 0, .5);box-shadow:.1em .1em .1em #888}.funding .progress .piece{font-size:1.3em;padding:.3em .5em}.funding .with-button .progress{width:78em}.funding .funding .funding-title-strong,.funding .funding-title{font-size:1.1em}.funding .funding-title-strong{font-weight:bold;font-size:1.5em}.funding .close{position:absolute;top:0;right:5px}.funding-top-header{@extend: .funding;width:97.5em}.wlfund{width:100%;border-collapse:collapse}.wlfund td{padding:0 0 1em 0;text-align:center}.wlfund td:last-child{text-align:right}.wlfund td div{padding:1em;box-shadow:0 2px 0 #DDD}.wlfund .funding-plus td div{background:rgba(13, 126, 133, .2)}.wlfund .funding-minus td div{background:#fff}.honking{background:#018189;font-size:1.5em;padding:.5em;color:#fff;border:0;box-shadow:.2em .2em .3em #888;position:relative}.honking:hover{box-shadow:none;top:.1em;left:.1em}.share a{margin-right:1.5em}.share a img{vertical-align:middle}.funding-handle{position:absolute;top:0;right:0;z-index:2;background:orange;cursor:pointer;padding:.2em 1em;border-radius:0 0 0 1em;font-size:13px}.funding-cover{float:left;margin-right:10px}.funding-details-intro{padding-top:1em}.funding-details-intro h3:first-of-type{margin-top:0}
\ No newline at end of file
diff --git a/apps/funding/static/funding/funding.js b/apps/funding/static/funding/funding.js
new file mode 100644 (file)
index 0000000..5b3b3f0
--- /dev/null
@@ -0,0 +1,27 @@
+$(function() {
+    $('.funding .close').click(function(e) {\r
+        e.preventDefault();
+        var fundNode = $(e.target).parent();\r
+        fundNode.slideUp(function(){fundingHandle.show()});
+        if(Modernizr.localstorage)
+            localStorage['hide-offer-id'] = fundNode.attr('data-offer-id');\r
+    });
+        
+
+    var fundingTopHeader = $('.funding-top-header');
+    var fundingHandle = $('.funding-handle');
+    if(fundingTopHeader) {
+        var currentOfferId = fundingTopHeader.attr('data-offer-id');
+        var toggle = true;
+        if(Modernizr.localstorage) {
+            toggle = localStorage['hide-offer-id'] !== currentOfferId;
+        }
+        fundingTopHeader.toggle(toggle);
+        fundingHandle.toggle(!toggle);
+    }
+    fundingHandle.click(function(e) {
+        fundingTopHeader.slideDown();
+        $(e.target).hide();
+        localStorage.removeItem('hide-offer-id');
+    });\r
+});
\ No newline at end of file
diff --git a/apps/funding/static/funding/funding.scss b/apps/funding/static/funding/funding.scss
new file mode 100755 (executable)
index 0000000..7d352df
--- /dev/null
@@ -0,0 +1,148 @@
+.funding {
+    background: orange;
+    margin: auto;
+    padding: 5px 0;
+    position: relative;
+    a.call {
+        height: 1.2em;
+        width: 9em;
+        padding: .35em .5em;
+        margin: .5em;
+        display: inline-block;
+        vertical-align: top;
+        text-align: center;
+
+        background: lighten(#018189, .05);
+    }
+    .description {
+        display: inline-block;
+        padding-left: .6em;
+        a {
+            display: block;
+            color: black;
+            padding: 0 3px;
+        }
+    }
+    strong {
+        font-size: 1.5em;
+        padding: .2em 0 0;
+        //display: block;
+    }
+    .progress {
+        .piece {
+            font-size: 1.3em;
+            padding: .3em .5em;
+        }
+        width: 95.7em;
+        margin: .3em 0 .4em;
+        border-radius: 2em;
+        background-image: url(/static/img/progress-pixel.png);
+        background-repeat: repeat-y;
+        background-color: fade-out(#ec6d00, .5);
+        box-shadow: .1em .1em .1em #888;
+    }
+    .with-button .progress {
+        width: 78em;
+    }
+    
+    .funding-title {
+        font-size: 1.1em;
+    }
+    .funding-title-strong {
+        @extend .funding-title;
+        font-weight: bold;
+        font-size: 1.5em;
+    }
+    .close {
+        position: absolute;
+        top: 0px;
+        right: 5px;
+    }
+}
+
+.funding-top-header {
+    @extend: .funding;
+    width: 97.5em;
+}
+
+
+.wlfund {
+    width: 100%;
+    border-collapse: collapse;
+
+    td {
+        padding: 0 0 1em 0;
+        text-align: center;
+    }
+
+    td:last-child {
+        text-align: right;
+    }
+
+    td div {
+        padding: 1em;
+        box-shadow: 0 2px 0 #DDDDDD;
+    }
+
+    .funding-plus td div {
+        background: fade-out(#0D7E85, .8);
+    }
+
+    .funding-minus td div {
+        background: white;
+    }
+}
+
+
+
+.honking {
+    background: #018189;
+    font-size: 1.5em;
+    padding: .5em;
+    color: white;
+    border: 0;
+    box-shadow: 0.2em 0.2em 0.3em #888888;
+    position: relative;
+}
+.honking:hover {
+    box-shadow: none;
+    top: .1em;
+    left: .1em;
+}
+
+
+
+.share {
+    a {
+        margin-right: 1.5em;
+
+        img {
+            vertical-align: middle;
+        }
+    }
+}
+
+.funding-handle {
+    position: absolute;
+    top: 0;
+    right: 0;
+    z-index:2;
+    background: orange;
+    cursor:pointer;
+    padding: .2em 1em;
+    border-radius: 0 0 0 1em;
+    font-size: 13px;
+}
+
+.funding-cover {
+    float:left;
+    margin-right: 10px;
+}
+
+.funding-details-intro {
+    padding-top: 1em;
+    
+    h3:first-of-type {
+        margin-top: 0;
+    }
+}
\ No newline at end of file
diff --git a/apps/funding/templates/funding/email.txt b/apps/funding/templates/funding/email.txt
new file mode 100644 (file)
index 0000000..e548767
--- /dev/null
@@ -0,0 +1,13 @@
+{% load i18n %}
+
+{% trans 'Hi' %}{% if name %} {{name}}{% endif %},
+
+{% trans 'Thank you for your support - thanks to you we will set another book free.' %}{% if name %}
+
+{% trans 'The book will be supplemented with your name as a donor.' %}{% endif %} 
+
+{% blocktrans %}We will contact you to keep you informed about your perks,
+status changes to this fundraiser and the incoming ones that we plan to launch.{% endblocktrans %}
+
+{% blocktrans %}Cheers,
+Wolne Lektury team{% endblocktrans %}
diff --git a/apps/funding/templates/funding/no_thanks.html b/apps/funding/templates/funding/no_thanks.html
new file mode 100755 (executable)
index 0000000..3c8db16
--- /dev/null
@@ -0,0 +1,23 @@
+{% extends "base.html" %}
+{% load i18n %}
+{% load fnp_share %}
+
+{% block titleextra %}{% trans "Payment failed" %}{% endblock %}
+
+{% block body %}
+
+<h1>{% trans "Payment failed" %}</h1>
+<div class="white-box normal-text">
+
+<p>{% trans "You're support has not been processed successfully." %}</p>
+
+{% url 'funding_current' as current %}
+<p>
+{% blocktrans with current=current %}Return to the <a href="{{current}}">current fundraiser</a> and try again or try to use a different payment method.{% endblocktrans %}
+</p>
+
+
+</div>
+
+
+{% endblock %}
diff --git a/apps/funding/templates/funding/offer_detail.html b/apps/funding/templates/funding/offer_detail.html
new file mode 100755 (executable)
index 0000000..905e03b
--- /dev/null
@@ -0,0 +1,98 @@
+{% extends "base.html" %}
+{% load url from future %}
+{% load i18n %}
+{% load funding_tags %}
+{% load pagination_tags %}
+{% load fnp_share %}
+{% load thumbnail %}
+
+
+{% block titleextra %}{{ object }}{% endblock %}
+
+{% block metadescription %}Wesprzyj kolejną publikację Wolnych Lektur!{% endblock %}
+
+
+{% block body %}
+
+<h1>{{ object }}</h1>
+
+{% funding object show_title=False %}
+<div class="white-box">
+    <div class="funding-details-intro">
+        {% if object.cover %}
+            <img src="
+                {% thumbnail object.cover "139x193" as thumb %}
+                    {{ thumb.url }}
+                {% empty %}
+                    {{ object.cover.url }}
+                {% endthumbnail %}
+            " alt="Cover" class="funding-cover" />
+        {% endif %}
+        <div class="normal-text">
+        <h3>{% trans "Help free the book!" %}</h3>
+        {{ object.description|safe }}
+        {% offer_status object %}
+        {% offer_status_more object %}
+        <p><a href="{% url 'infopage' 'wesprzyj' %}">{% trans "Learn more" %}</a>.</p>
+        </div>
+        
+        <div style="clear:both;"></div>
+    </div>
+
+    {% if object.is_current %}
+        <div class="normal-text">
+            <h3>{% trans "Support the publication" %}</h3>
+            <form action="" method="post">
+                {% csrf_token %}
+                <table>
+                {{ form.as_table }}
+                <tr><td></td><td>
+                    <button type="submit" style="border: none; background: none; cursor: pointer">
+                    <img alt="{% trans 'Donate!' %}" src="http://static.payu.com/pl/standard/partners/buttons/payu_account_button_01.png" />
+                    </button>
+                    </td></tr>
+                </table>
+            </form>
+        </div>
+
+        {% url 'funding_current' object.slug as current %}
+        <p class="normal-text">{% trans "Tell your friends!" %}</p>
+        <p class="share">{% share current _("Support Wolne Lektury!") "big" %}</p>
+    {% endif %}
+
+    <p class="normal-text"><a href="{% url 'funding' %}">{% trans "See all fundraisers." %}</a></p>
+
+</div>
+
+
+<h2>{% trans "Supporters" %}:</h2>
+
+<div class="white-box normal-text">
+{% with object.funding_payed.all as fundings %}
+    
+    <table class="wlfund">
+    {% autopaginate fundings 10 %}
+    {% for funding in fundings %}
+        <tr class="funding-plus">
+            <td><div>{{ funding.payed_at.date }}</div></td>
+            <td><div>
+                {% if funding.name %}
+                    {{ funding.name }}
+                {% else %}
+                    <em>{% trans "Anonymous" %}</em>
+                {% endif %}
+            </div></td>
+            <td><div>{{ funding.amount }} zł</div></td>
+            <td><div>
+                {% for perk in funding.perks.all %}
+                    {{ perk.name }}{% if not forloop.last %},{% endif %}
+                {% endfor %}&nbsp;
+            </div></td>
+    {% endfor %}
+    </table>
+    
+    {% paginate %}
+{% endwith %}
+</div>
+
+{% endblock %}
diff --git a/apps/funding/templates/funding/offer_list.html b/apps/funding/templates/funding/offer_list.html
new file mode 100755 (executable)
index 0000000..0770b10
--- /dev/null
@@ -0,0 +1,44 @@
+{% extends "base.html" %}
+{% load url from future %}
+{% load i18n %}
+{% load funding_tags %}
+{% load pagination_tags %}
+
+{% block titleextra %}{% trans "All fundraisers" %}{% endblock %}
+
+{% block bodyid %}funding-offer-list{% endblock %}
+
+{% block body %}
+<h1>{% trans "All fundraisers" %}</h1>
+
+
+{% autopaginate object_list 10 %}
+{% for offer in object_list %}
+{% with is_win=offer.is_win is_current=offer.is_current %}
+
+    {% if is_current %}
+        <h2>{% trans "Current fundraiser:" %}</h2>
+    {% elif forloop.is_first %}
+        <h2>{% trans "Previous fundraisers:" %}</h2>
+    {% endif %}
+
+    {% funding offer link=1 show_title_calling=False %}
+
+    <div class="white-box normal-text">
+        {% if is_current %}
+            <h3>{% trans "Help free the book!" %}</h3>
+            {{ offer.description|safe }}
+        {% endif %}
+        {% offer_status offer %}
+        {% offer_status_more offer %}
+    </div>
+
+    {% if is_current and not forloop.is_last %}
+        <h2>{% trans "Previous fundraisers:" %}</h2>
+    {% endif %}
+
+{% endwith %}
+{% endfor %}
+{% paginate %}
+
+{% endblock %}
diff --git a/apps/funding/templates/funding/snippets/any_remaining.html b/apps/funding/templates/funding/snippets/any_remaining.html
new file mode 100755 (executable)
index 0000000..d8a5bd6
--- /dev/null
@@ -0,0 +1,10 @@
+
+{% load i18n %}
+{% url 'funding_wlfund' as wlfund %}
+{% blocktrans %}Any <a href="{{wlfund}}">remaining funds</a> will be spent
+on other books waiting to be published.{% endblocktrans %}
+<br/><br/>
+{% blocktrans %}We will supplement every book with your name as a donor, no matter how
+big your support will be.{% endblocktrans %}
+
+
diff --git a/apps/funding/templates/funding/tags/funding.html b/apps/funding/templates/funding/tags/funding.html
new file mode 100755 (executable)
index 0000000..ffe326e
--- /dev/null
@@ -0,0 +1,49 @@
+{% load i18n %}
+{% load time_tags %}
+{% if offer %}
+{% spaceless %}
+<div class="funding {{ add_class }}" data-offer-id="{{offer.id}}" style="">
+    {% if closeable %}<a href="#" class="close">X</a>{% endif %}
+    {% if link and is_current %}
+        <div style="float:left; padding-right: .6em;">
+            <a class="call honking" href="{% url 'funding_current' offer.slug %}">
+                {% trans "Support!" %}</a>
+            <div style="text-align: center; margin: auto;">
+                <a href="{% url 'infopage' 'wesprzyj' %}">{% trans "Learn more" %}</a>
+            </div>
+        </div>
+    {% endif %}
+    <div class="description {% if link and is_current %}with-button{% endif %}"
+        style="display: inline-block;">
+    {% if link %}<a href="{% if is_current %}{% url 'funding_current' offer.slug %}{% else %}{{ offer.get_absolute_url }}{% endif %}">{% endif %}
+    {% if show_title %}
+        {% if is_current and show_title_calling %}<strong style="margin-right: .6em;">{% trans "Help free the book!" %}</strong>{% endif %}
+        <span class="funding-title{% if not is_current %}-strong{% endif %}">{{ offer }}</span>
+    {% endif %}
+
+    <div class="progress"
+        style="text-align: center; background-size: {{ percentage|stringformat:'.2f' }}% 1px;"
+    >
+        {% if sum %}
+            <span class="piece" style="float:left">{% trans "collected" %}: {{ sum }} zł</span>
+        {% endif %}
+        {% if not is_win %}
+            <span class="piece" style="float: right">{% trans "needed" %}: {{ offer.target }} zł</span>
+        {% endif %}
+        {% if is_current %}
+            <span class="piece" style="display:inline-block;margin-right: 0em;">{% trans "until fundraiser end" %}:
+                <span class="countdown inline" data-until='{{ offer.end|date_to_utc:True|utc_for_js }}'></span>
+            </span>
+        {% endif %}
+
+        <div style="clear: both"></div>
+    </div>
+    {% if link %}</a>{% endif %}
+    </div>
+    <div style="clear: both"></div>
+</div>
+{% if closeable %}
+    <div class="funding-handle">{% trans "Help free the book!" %}</div>
+{% endif %}
+{% endspaceless %}
+{% endif %}
diff --git a/apps/funding/templates/funding/tags/offer_status.html b/apps/funding/templates/funding/tags/offer_status.html
new file mode 100755 (executable)
index 0000000..1c14068
--- /dev/null
@@ -0,0 +1,29 @@
+{% load i18n %}
+
+{% if offer.is_current %}
+    {% if offer.is_win %}
+        <p>
+            {% blocktrans with due=offer.due end=offer.end %}The fundraiser
+            ends on {{ end }}. The book will be published by {{ due }}.{% endblocktrans %}
+        </p>
+    {% else %}
+    <p>
+        <strong>{% blocktrans with target=offer.target|floatformat %}W need {{target}} zł to digitize it,
+        compile it and publish for free in multiple formats.{% endblocktrans %}</strong>
+    </p>
+    <p>
+        {% blocktrans with end=offer.end %}If we raise enought money before {{end}} we will
+        publish it and make it available for everyone.{% endblocktrans %}
+    </p>
+    {% endif %}
+{% else %}
+    {% if offer.is_win %}
+        <p>
+            {% trans "Full amount was successfully raised!" %}
+        </p>
+    {% else %}
+        <p>
+            {% trans "The amount needed was not raised." %}
+        </p>
+    {% endif %}
+{% endif %}
diff --git a/apps/funding/templates/funding/tags/offer_status_more.html b/apps/funding/templates/funding/tags/offer_status_more.html
new file mode 100755 (executable)
index 0000000..5c6efb1
--- /dev/null
@@ -0,0 +1,28 @@
+{% load i18n %}
+
+{% if offer.is_current %}
+        <p>
+            {% include "funding/snippets/any_remaining.html" %}
+        </p>
+{% else %}
+    <p class="date">{% trans "Fundraiser span" %}: {{ offer.start }} – {{ offer.end }}</p>
+    {% if offer.is_win %}
+        <p>
+            {% if offer.book %}
+                {% blocktrans with bu=offer.book.get_absolute_url bt=offer.book %}The book
+                <a href="{{ bu }}">{{ bt }}</a> has been already published.{% endblocktrans %}
+            {% else %}
+                {% blocktrans with due=offer.due %}The book
+                will be published by {{ due }}.{% endblocktrans %}
+                {% if offer.redakcja_link %}
+                    {% blocktrans with r=offer.redakcja_url %}You can follow
+                    the work on the <a href="{{ r }}">Editorial Platform</a>.{% endblocktrans %}
+                {% endif %}
+            {% endif %}
+        </p>
+    {% endif %}
+
+    {% if offer.remaining %}
+        <p>{% include "funding/snippets/any_remaining.html" %}</p>
+    {% endif %}
+{% endif %}
diff --git a/apps/funding/templates/funding/thanks.html b/apps/funding/templates/funding/thanks.html
new file mode 100755 (executable)
index 0000000..efff200
--- /dev/null
@@ -0,0 +1,45 @@
+{% extends "base.html" %}
+{% load i18n %}
+{% load fnp_share %}
+{% load polls_tags %}
+
+{% block titleextra %}{% trans "Thank you for your support!" %}{% endblock %}
+
+{% block body %}
+
+<h1>{% trans "Thank you!" %}</h1>
+<div class="white-box normal-text">
+
+{% trans "Thank you for your support!" %}
+
+{% if offer.is_win %}
+    <p>{% trans "Full amount was successfully raised!" %}</p>
+
+    <p>{% blocktrans with due=offer.due end=offer.end %}The fundraiser
+            ends on {{ end }}. The book will be published by {{ due }}.{% endblocktrans %}</p>
+{% else %}
+    <p>
+        {% blocktrans with b=offer.title %}Your donation will be spent on digitizing, compiling and
+        publishing the book {{ b }} in multiple formats. We will contact you if you qualify for perks.{% endblocktrans %}
+    </p>
+{% endif %}
+
+<p>{% include "funding/snippets/any_remaining.html" %}
+
+<a href="{% url 'infopage' 'wesprzyj' %}">{% trans "Learn more" %}</a>.</p>
+
+{% url 'funding_current' offer.slug as current %}
+<p><a href="{{ current }}">{% trans "Go back to the current fundraiser." %}</a></p>
+
+
+<h3>{% trans "Tell your friends!" %}</h3>
+<p class="share">{% share current _("I support Wolne Lektury.") "big" %}</p>
+
+{% if offer.poll %}
+    <h3>{% trans "Vote for a book for the next fundraiser" %}</h3>
+    {% poll offer.poll %}
+{% endif %}
+</div>
+
+
+{% endblock %}
diff --git a/apps/funding/templates/funding/widgets/amount.html b/apps/funding/templates/funding/widgets/amount.html
new file mode 100644 (file)
index 0000000..5563d00
--- /dev/null
@@ -0,0 +1,19 @@
+{% load i18n %}
+<div style="line-height:2em;">
+{% if perks %}
+    {% for perk in perks %}
+        <label>
+            <input type="radio" name="{{ perks_input_name }}" value="{{ perk.price }}"
+                    {% if perk.chosen %}checked="checked"{% endif %} />
+                <span style="font-size: 1.5em; ">{{ perk.price }} zł</span> ({{ perk.name }})
+        </label><br/>
+    {% endfor %}
+    <label>
+        <input type="radio" name="{{ perks_input_name }}" value=""
+            {% if not perk_chosen %}checked="checked"{% endif %} /> {% trans "Other amount" %}:
+    </label>
+    <input size="5" name="{{ name }}" value="{% if not perk_chosen %}{{ value|default_if_none:'' }}{% endif %}" /> zł
+{% else %}
+    <input name="{{ name }}" value="{{ value|default_if_none:'' }}" {% if value != None %}{% endif %} />
+{% endif %}
+</div>
diff --git a/apps/funding/templates/funding/wlfund.html b/apps/funding/templates/funding/wlfund.html
new file mode 100755 (executable)
index 0000000..54416fa
--- /dev/null
@@ -0,0 +1,56 @@
+{% extends "base.html" %}
+{% load i18n %}
+
+{% block titleextra %}{% trans "Remaining funds" %}{% endblock %}
+
+{% block body %}
+
+<h1>{% trans "Remaining funds" %}</h1>
+
+<div class="left-column normal-text">
+<p>{% blocktrans with r="http://redakcja.wolnelektury.pl/" %}If
+the full amount needed for publishing a book is not raised in time,
+the funds are spent on <a href="{{r}}">other books waiting for
+publication</a>. The same thing happens with any money remaining
+from successful fundraisers.{% endblocktrans %}
+
+<a href="{% url 'infopage' 'wesprzyj' %}">{% trans "Learn more" %}</a>.</p>
+
+<p>{% trans "Spending these remaining funds is recorded in this table." %}</p>
+</div>
+
+
+<table class="normal-text wlfund">
+
+    <tr>
+        <td><div>{% trans "Date" %}:</div></td>
+        <td><div>{% trans "Operation" %}:</div></td>
+        <td><div>{% trans "Amount" %}:</div></td>
+        <td><div>{% trans "Balance" %}:</div></td>
+    </tr>
+
+    {% for tag, entry in log %}
+    {% if tag == 'spent' %}
+        <tr class="funding-minus">
+            <td><div>{{ entry.timestamp }}</div></td>
+            <td><div>{% trans "Money spent on publishing the book" %}:
+                <a href="{{ entry.book.get_absolute_url }}">
+                {{ entry.book }}</a></div></td>
+            <td><div>-{{ entry.amount }} zł</div></td>
+            <td><div>{{ entry.total }} zł</div></td>
+        </tr>
+    {% else %}
+        <tr class="funding-plus">
+            <td><div>{{ entry.end }}</div></td>
+            <td><div>{% trans "Money remaining from the fundraiser for" %}:
+                <a href="{{ entry.get_absolute_url }}">
+                {{ entry }}</a></div></td>
+            <td><div>+{{ entry.wlfund }} zł</div></td>
+            <td><div>{{ entry.total }} zł</div></td>
+        </tr>
+    {% endif %}
+    {% endfor %}
+</table>
+
+
+{% endblock %}
diff --git a/apps/funding/templatetags/__init__.py b/apps/funding/templatetags/__init__.py
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/apps/funding/templatetags/funding_tags.py b/apps/funding/templatetags/funding_tags.py
new file mode 100755 (executable)
index 0000000..eb60601
--- /dev/null
@@ -0,0 +1,42 @@
+from django import template
+from ..models import Offer
+
+register = template.Library()
+
+
+@register.inclusion_tag("funding/tags/funding.html", takes_context=True)
+def funding(context, offer=None, link=False, closeable=False, show_title=True, show_title_calling = True, add_class=""):
+    if offer is None and context.get('funding_no_show_current') is None:
+        offer = Offer.current()
+    if offer is None:
+        return {}
+
+    offer_sum = offer.sum()
+    return {
+        'offer': offer,
+        'sum': offer_sum,
+        'is_current': offer.is_current(),
+        'is_win': offer_sum >= offer.target,
+        'missing': offer.target - offer_sum,
+        'percentage': 100 * offer_sum / offer.target,
+        'link': link,
+        'closeable': closeable,
+        'show_title': show_title,
+        'show_title_calling': show_title_calling,
+        'add_class': add_class,
+    }
+
+
+@register.inclusion_tag("funding/tags/offer_status.html")
+def offer_status(offer):
+    return {
+        'offer': offer,
+    }
+    
+@register.inclusion_tag("funding/tags/offer_status_more.html")
+def offer_status_more(offer):
+    return {
+        'offer': offer,
+    }
+
+
diff --git a/apps/funding/tests.py b/apps/funding/tests.py
new file mode 100644 (file)
index 0000000..c9438a8
--- /dev/null
@@ -0,0 +1,28 @@
+# -*- 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.
+#
+from django.test import TestCase
+from .models import Offer, Perk, Funding
+
+
+class FundTest(TestCase):
+    def setUp(self):
+        self.offer1 = Offer.objects.create(
+            author='author1', title='title1', slug='slug1',
+            target=100, start='2013-03-01', end='2013-03-31')
+
+    def test_perks(self):
+        perk = Perk.objects.create(price=20, name='Perk 20')
+        perk1 = Perk.objects.create(offer=self.offer1, price=50, name='Perk 50')
+        offer2 = Offer.objects.create(
+            author='author2', title='title2', slug='slug2',
+            target=100, start='2013-02-01', end='2013-02-20')
+        perk2 = Perk.objects.create(offer=offer2, price=1, name='Perk 1')
+
+        self.assertEqual(
+            set(self.offer1.fund('Tester', 'test@example.com', 10).perks.all()),
+            set())
+        self.assertEqual(
+            set(self.offer1.fund('Tester', 'test@example.com', 70).perks.all()),
+            set([perk, perk1]))
diff --git a/apps/funding/urls.py b/apps/funding/urls.py
new file mode 100644 (file)
index 0000000..e92704d
--- /dev/null
@@ -0,0 +1,24 @@
+# -*- 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.
+#
+from django.conf.urls import patterns, url, include
+
+from .models import Offer
+from .views import (WLFundView, OfferDetailView, OfferListView,
+                ThanksView, NoThanksView, CurrentView)
+
+
+urlpatterns = patterns('',
+
+    url(r'^$', CurrentView.as_view(), name='funding_current'),
+    url(r'^teraz/(?P<slug>[^/]+)/$', CurrentView.as_view(), name='funding_current'),
+    url(r'^lektura/$', OfferListView.as_view(), name='funding'),
+    url(r'^lektura/(?P<slug>[^/]+)/$', OfferDetailView.as_view(), name='funding_offer'),
+    url(r'^pozostale/$', WLFundView.as_view(), name='funding_wlfund'),
+    
+    url(r'^dziekujemy/$', ThanksView.as_view(), name='funding_thanks'),
+    url(r'^niepowodzenie/$', NoThanksView.as_view(), name='funding_nothanks'),
+    
+    url(r'^getpaid/', include('getpaid.urls')),
+)
diff --git a/apps/funding/views.py b/apps/funding/views.py
new file mode 100644 (file)
index 0000000..bf2a073
--- /dev/null
@@ -0,0 +1,140 @@
+# -*- 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.
+#
+from datetime import date
+from django.views.decorators.cache import never_cache
+from django.conf import settings
+from django.core.urlresolvers import reverse
+from django.http import Http404
+from django.shortcuts import redirect, get_object_or_404
+from django.views.generic import TemplateView, FormView, DetailView, ListView
+import getpaid.backends.payu
+from getpaid.models import Payment
+from .forms import FundingForm
+from .models import Offer, Spent, Funding
+
+
+def mix(*streams):
+    substreams = []
+    for stream, read_date, tag in streams:
+        iterstream = iter(stream)
+        try:
+            item = next(iterstream)
+        except StopIteration:
+            pass
+        else:
+            substreams.append([read_date(item), item, iterstream, read_date, tag])
+    while substreams:
+        i, substream = max(enumerate(substreams), key=lambda x: x[1][0])
+        yield substream[4], substream[1]
+        try:
+            item = next(substream[2])
+        except StopIteration:
+            del substreams[i]
+        else:
+            substream[0:2] = [substream[3](item), item]
+
+
+class WLFundView(TemplateView):
+    template_name = "funding/wlfund.html"
+
+    def get_context_data(self):
+        def add_total(total, it):
+            for tag, e in it:
+                e.total = total
+                if tag == 'spent':
+                    total += e.amount
+                else:
+                    total -= e.wlfund
+                yield tag, e
+
+        ctx = super(WLFundView, self).get_context_data()
+        offers = []
+        
+        for o in Offer.past():
+            if o.is_win():
+                o.wlfund = o.sum() - o.target
+                if o.wlfund > 0:
+                    offers.append(o)
+            else:
+                o.wlfund = o.sum()
+                if o.wlfund > 0:
+                    offers.append(o)
+        amount = sum(o.wlfund for o in offers) - sum(o.amount for o in Spent.objects.all())
+
+        ctx['amount'] = amount
+        ctx['log'] = add_total(amount, mix(
+            (offers, lambda x: x.end, 'offer'),
+            (Spent.objects.all().select_related(), lambda x: x.timestamp, 'spent'),
+        ))
+        return ctx
+
+
+class OfferDetailView(FormView):
+    form_class = FundingForm
+    template_name = "funding/offer_detail.html"
+    backend = 'getpaid.backends.payu'
+
+    def dispatch(self, request, slug=None):
+        if getattr(self, 'object', None) is None:
+            if slug:
+                self.object = get_object_or_404(Offer.public(), slug=slug)
+            else:
+                self.object = Offer.current()
+                if self.object is None:
+                    raise Http404
+        return super(OfferDetailView, self).dispatch(request, slug)
+
+    def get_form(self, form_class):
+        if self.request.method == 'POST':
+            return form_class(self.object, self.request.POST)
+        else:
+            return form_class(self.object, initial={'amount': settings.FUNDING_DEFAULT})
+
+    def get_context_data(self, *args, **kwargs):
+        ctx = super(OfferDetailView, self).get_context_data(*args, **kwargs)
+        ctx['object'] = self.object
+        if self.object.is_current():
+            ctx['funding_no_show_current'] = True
+        return ctx
+
+    def form_valid(self, form):
+        funding = form.save()
+        # Skip getpaid.forms.PaymentMethodForm, go directly to the broker.
+        payment = Payment.create(funding, self.backend)
+        gateway_url_tuple = payment.get_processor()(payment).get_gateway_url(self.request)
+        payment.change_status('in_progress')
+        return redirect(gateway_url_tuple[0])
+
+
+class CurrentView(OfferDetailView):
+    def dispatch(self, request, slug=None):
+        self.object = Offer.current()
+        if self.object is None:
+            raise Http404
+        elif slug != self.object.slug:
+            return redirect(reverse('funding_current', args=[self.object.slug]))
+        return super(CurrentView, self).dispatch(request, slug)
+
+
+class OfferListView(ListView):
+    queryset = Offer.public()
+
+    def get_context_data(self, *args, **kwargs):
+        ctx = super(OfferListView, self).get_context_data(*args, **kwargs)
+        ctx['funding_no_show_current'] = True
+        return ctx
+
+
+class ThanksView(TemplateView):
+    template_name = "funding/thanks.html"
+
+    def get_context_data(self, *args, **kwargs):
+        ctx = super(ThanksView, self).get_context_data(*args, **kwargs)
+        ctx['offer'] = Offer.current()
+        ctx['funding_no_show_current'] = True
+        return ctx
+
+class NoThanksView(TemplateView):
+    template_name = "funding/no_thanks.html"
diff --git a/apps/funding/widgets.py b/apps/funding/widgets.py
new file mode 100644 (file)
index 0000000..cd7bf9b
--- /dev/null
@@ -0,0 +1,41 @@
+# -*- 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.
+#
+from decimal import Decimal
+from django.conf import settings
+from django import forms
+from django.template.loader import render_to_string
+
+
+class PerksAmountWidget(forms.Textarea):
+    def perks_input_name(self, name):
+        return "_%s_perk" % name
+
+    def render(self, name, value, attrs=None):
+        try:
+            value = Decimal(value)
+        except:
+            pass
+        perks = list(self.form_instance.offer.get_perks())
+        perk_chosen = False
+        for perk in perks:
+            if perk.price == value:
+                perk.chosen = True
+                perk_chosen = True
+                break
+
+        return render_to_string("funding/widgets/amount.html", {
+                "perks": perks,
+                "name": name,
+                "perks_input_name": self.perks_input_name(name),
+                "perk_chosen": perk_chosen,
+                "value": value,
+                "attrs": attrs,
+            })
+
+    def value_from_datadict(self, data, files, name):
+        num_str = data.get(self.perks_input_name(name)) or data[name]
+        return num_str.replace(',', '.')
+            
+    
index 0148296..cc7decb 100644 (file)
             <p>Przygotowaliśmy kilka propozycji na start – możesz wybrać jedną z nich,
             albo ułożyć sobie własną, niepowtarzalną mieszankę.</p>
         <ul>
-            <li><h2><a href="{% url 'poem_from_book' 'liryki-lozanskie' %}">Adam Mickiewicz, Liryki lozańskie</a></h2></li>
-            <li><h2><a href="{% url 'poem_from_book' 'sonety-krymskie' %}">Adam Mickiewicz, Sonety krymskie</a></h2></li>
-            <li><h2><a href="{% url 'poem_from_book' 'hymny' %}">Jan Kasprowicz, Hymny</a></h2></li>
-            <li><h2><a href="{% url 'poem_from_book' 'bogurodzica' %}">Bogurodzica</a></h2></li>
+            <li><a href="{% url 'poem_from_book' 'liryki-lozanskie' %}">Adam Mickiewicz, Liryki lozańskie</a></li>
+            <li><a href="{% url 'poem_from_book' 'sonety-krymskie' %}">Adam Mickiewicz, Sonety krymskie</a></li>
+            <li><a href="{% url 'poem_from_book' 'hymny' %}">Jan Kasprowicz, Hymny</a></li>
+            <li><a href="{% url 'poem_from_book' 'bogurodzica' %}">Bogurodzica</a></li>
             {% for s in shelves %}
-                <li><h2><a href="{% url 'poem_from_set' s.slug %}">{{ s.name }}</a></h2></li>
+                <li><a href="{% url 'poem_from_set' s.slug %}">{{ s.name }}</a></li>
             {% endfor %}
     
     </div>
index be942f6..fe413ce 100644 (file)
@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 from django.conf import settings
 from django.db.models.fields import Field, CharField
+from django.utils.translation import string_concat
 
 from modeltranslation.utils import get_language, build_localized_fieldname
 
@@ -44,12 +45,8 @@ class TranslationField(Field):
 
         # Copy the verbose name and append a language suffix (will e.g. in the
         # admin). This might be a proxy function so we have to check that here.
-        if hasattr(translated_field.verbose_name, '_proxy____unicode_cast'):
-            verbose_name = \
-                translated_field.verbose_name._proxy____unicode_cast()
-        else:
-            verbose_name = translated_field.verbose_name
-        self.verbose_name = '%s [%s]' % (verbose_name, language)
+        self.verbose_name = string_concat(translated_field.verbose_name,
+            ' [%s]' % (language, ))
 
     def pre_save(self, model_instance, add):
         val = super(TranslationField, self).pre_save(model_instance, add)
index 59e599c..eabb59c 100644 (file)
@@ -12,6 +12,7 @@ from lxml.etree import ElementTree
 from django.db.models import Q
 from django.conf import settings
 from django.contrib.sites.models import Site
+from django.utils import timezone
 
 
 WL_DC_READER_XPATH = '(.|*)/rdf:RDF/rdf:Description/%s/text()' 
@@ -60,7 +61,7 @@ class Catalogue(common.ResumptionOAIPMH):
         self.oai_id = "oai:" + Site.objects.get_current().domain + ":%s"
 
         # earliest change
-        year_zero = datetime(1990, 1, 1, 0, 0, 0)
+        year_zero = timezone.make_aware(datetime(1990, 1, 1, 0, 0, 0), timezone.utc)
 
         try:
             earliest_change = \
index 0352076..a1ff537 100755 (executable)
@@ -1,8 +1,7 @@
 (function($) {
     $(function() {
 
-
-        $('#countdown').each(function() {
+        $('.countdown').each(function() {
             var $this = $(this);
 
             var serverTime = function() {
                 $.countdown.setDefaults($.countdown.regional['']);
             }
 
-            var d = new Date($this.attr('data-year'), 0, 1);
-            function re() {location.reload()};
-            $this.countdown({until: d, format: 'ydHMS', serverSync: serverTime,
-                onExpiry: re, alwaysExpire: true});
-
+            var options = {
+                until: new Date($this.attr('data-until')),
+                format: 'ydHMS',
+                serverSync: serverTime,
+                onExpiry: function(){location.reload()}, // TODO: no reload
+            };
+            if ($this.hasClass('inline')) {
+                options.layout = '{d<}{dn} {dl} {d>}{hnn}{sep}{mnn}{sep}{snn}';
+            }
+            
+            $this.countdown(options);
         });
 
 
     });
-})(jQuery);
\ No newline at end of file
+})(jQuery);
index fc3bd5b..50eef63 100644 (file)
@@ -1,5 +1,6 @@
 {% extends "base.html" %}
 {% load i18n %}
+{% load time_tags %}
 
 {% block titleextra %}{{ author.name }}{% endblock %}
 
@@ -40,7 +41,7 @@
             {% else %}
                 <div>
                     <p>{% trans "This author's works will become part of public domain and will be allowed to be published without restrictions in" %}</p>
-                    <div id='countdown' data-year='{{ pd_counter }}'></div>
+                    <div class='countdown' data-until='{{ pd_counter|date_to_utc|utc_for_js }}'></div>
                     <p>{% trans "<a href='http://domenapubliczna.org/co-to-jest-domena-publiczna/'>Find out</a> why Internet libraries can't publish this author's works." %}</p>
                 </div>
             {% endif %}
index 40ddbd8..640d68e 100644 (file)
@@ -1,5 +1,6 @@
 {% extends "base.html" %}
 {% load i18n %}
+{% load time_tags %}
 
 {% block titleextra %}{{ book.title }}{% endblock %}
 
@@ -17,7 +18,7 @@
        {% else %}
            {% if book.pd %}
                        <p>{% trans "This work will become part of public domain and will be allowed to be published without restrictions in" %}</p>
-            <div id='countdown' data-year='{{ pd_counter }}'></div>
+            <div class='countdown' data-until='{{ pd_counter|date_to_utc|utc_for_js }}'></div>
                        <p>{% trans "<a href='http://domenapubliczna.org/co-to-jest-domena-publiczna/'>Find out</a> why Internet libraries can't publish this work." %}</p>
                {% else %}
                    <p>{% trans "This work is copyrighted." %}
diff --git a/apps/pdcounter/templatetags/__init__.py b/apps/pdcounter/templatetags/__init__.py
new file mode 100755 (executable)
index 0000000..e69de29
diff --git a/apps/pdcounter/templatetags/time_tags.py b/apps/pdcounter/templatetags/time_tags.py
new file mode 100755 (executable)
index 0000000..e454acd
--- /dev/null
@@ -0,0 +1,27 @@
+import datetime
+import pytz
+from django.conf import settings
+from django import template
+from django.utils import timezone
+
+
+register = template.Library()
+
+@register.filter
+def date_to_utc(date, day_end=False):
+    """ Converts a datetime.date to UTC datetime.
+
+    The datetime represents the start (or end) of the given day in
+    the server's timezone.
+    """
+    if day_end:
+        date += datetime.timedelta(1)
+    localtime = datetime.datetime.combine(date, datetime.time(0,0))
+    return timezone.utc.normalize(
+        pytz.timezone(settings.TIME_ZONE).localize(localtime)
+    )
+
+
+@register.filter
+def utc_for_js(dt):
+    return dt.strftime('%Y/%m/%d %H:%M:%S UTC')
index b07ee11..8fb1b13 100644 (file)
@@ -2,8 +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 datetime import datetime
-
+from datetime import datetime
 from django.template import RequestContext
 from django.shortcuts import render_to_response, get_object_or_404
 from pdcounter import models
@@ -12,7 +11,7 @@ from suggest.forms import PublishingSuggestForm
 
 def book_stub_detail(request, slug):
     book = get_object_or_404(models.BookStub, slug=slug)
-    pd_counter = book.pd
+    pd_counter = datetime(book.pd, 1, 1)
 
     form = PublishingSuggestForm(
             initial={"books": u"%s — %s, \n" % (book.author, book.title)})
@@ -23,7 +22,7 @@ def book_stub_detail(request, slug):
 
 def author_detail(request, slug):
     author = get_object_or_404(models.Author, slug=slug)
-    pd_counter = author.goes_to_pd()
+    pd_counter = datetime(author.goes_to_pd(), 1, 1)
 
     form = PublishingSuggestForm(initial={"books": author.name + ", \n"})
 
diff --git a/apps/polls/__init__.py b/apps/polls/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/apps/polls/admin.py b/apps/polls/admin.py
new file mode 100644 (file)
index 0000000..29fc0aa
--- /dev/null
@@ -0,0 +1,21 @@
+from django.contrib import admin
+
+from models import Poll, PollItem
+
+
+class PollItemInline(admin.TabularInline):
+    model = PollItem
+    extra = 0
+    readonly_fields = ('vote_count',)
+    
+    
+class PollAdmin(admin.ModelAdmin):
+    inlines = [PollItemInline]
+    
+
+class PollItemAdmin(admin.ModelAdmin):
+    readonly_fields = ('vote_count',)
+    
+    
+admin.site.register(Poll, PollAdmin)
+admin.site.register(PollItem, PollItemAdmin)
\ No newline at end of file
diff --git a/apps/polls/forms.py b/apps/polls/forms.py
new file mode 100644 (file)
index 0000000..f9ca907
--- /dev/null
@@ -0,0 +1,10 @@
+from django import forms\r
+\r
+\r
+class PollForm(forms.Form):\r
+    vote = forms.ChoiceField(widget = forms.RadioSelect)\r
+    \r
+    def __init__(self, *args, **kwargs):
+        poll = kwargs.pop('poll', None)\r
+        super(PollForm, self).__init__(*args, **kwargs)\r
+        self.fields['vote'].choices = [(item.id, item.content) for item in poll.items.all()]
\ No newline at end of file
diff --git a/apps/polls/locale/pl/LC_MESSAGES/django.mo b/apps/polls/locale/pl/LC_MESSAGES/django.mo
new file mode 100644 (file)
index 0000000..d1d6fa7
Binary files /dev/null and b/apps/polls/locale/pl/LC_MESSAGES/django.mo differ
diff --git a/apps/polls/locale/pl/LC_MESSAGES/django.po b/apps/polls/locale/pl/LC_MESSAGES/django.po
new file mode 100644 (file)
index 0000000..5b902f8
--- /dev/null
@@ -0,0 +1,68 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-05-20 14:04+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\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"
+"Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 "
+"|| n%100>=20) ? 1 : 2);\n"
+
+#: models.py:10
+msgid "Poll"
+msgstr "Ankieta"
+
+#: models.py:11
+msgid "Polls"
+msgstr "Ankiety"
+
+#: models.py:13
+msgid "question"
+msgstr "Pytanie"
+
+#: models.py:14
+msgid "slug"
+msgstr "slug"
+
+#: models.py:15
+msgid "open"
+msgstr "otwarta"
+
+#: models.py:19
+msgid "Slug of an open poll needs to be unique"
+msgstr "Slug otwartej ankiety musi być unikalny"
+
+#: models.py:36
+msgid "content"
+msgstr "treść"
+
+#: models.py:37
+msgid "vote count"
+msgstr "licznik głosów"
+
+#: models.py:40
+msgid "vote item"
+msgstr "Pozycja ankiety"
+
+#: models.py:41
+msgid "vote items"
+msgstr "Pozycje ankiety"
+
+#: templates/polls/poll.html:11
+msgid "Thanks for voting! You can see current results below."
+msgstr "Dziękujemy za oddanie głosu w ankiecie! Poniżej znajdują się bieżące wyniki."
+
+#: templates/polls/tags/poll.html:28
+msgid "Submit"
+msgstr "Wyślij"
diff --git a/apps/polls/migrations/0001_initial.py b/apps/polls/migrations/0001_initial.py
new file mode 100644 (file)
index 0000000..e5550b0
--- /dev/null
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding model 'Poll'
+        db.create_table(u'polls_poll', (
+            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('question', self.gf('django.db.models.fields.TextField')()),
+            ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50)),
+            ('open', self.gf('django.db.models.fields.BooleanField')(default=False)),
+        ))
+        db.send_create_signal(u'polls', ['Poll'])
+
+        # Adding model 'PollItem'
+        db.create_table(u'polls_pollitem', (
+            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('poll', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['polls.Poll'])),
+            ('content', self.gf('django.db.models.fields.TextField')()),
+            ('vote_count', self.gf('django.db.models.fields.IntegerField')(default=0)),
+        ))
+        db.send_create_signal(u'polls', ['PollItem'])
+
+
+    def backwards(self, orm):
+        # Deleting model 'Poll'
+        db.delete_table(u'polls_poll')
+
+        # Deleting model 'PollItem'
+        db.delete_table(u'polls_pollitem')
+
+
+    models = {
+        u'polls.poll': {
+            'Meta': {'object_name': 'Poll'},
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'open': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'question': ('django.db.models.fields.TextField', [], {}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'})
+        },
+        u'polls.pollitem': {
+            'Meta': {'object_name': 'PollItem'},
+            'content': ('django.db.models.fields.TextField', [], {}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'poll': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['polls.Poll']"}),
+            'vote_count': ('django.db.models.fields.IntegerField', [], {'default': '0'})
+        }
+    }
+
+    complete_apps = ['polls']
\ No newline at end of file
diff --git a/apps/polls/migrations/__init__.py b/apps/polls/migrations/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/apps/polls/models.py b/apps/polls/models.py
new file mode 100644 (file)
index 0000000..d63e5aa
--- /dev/null
@@ -0,0 +1,60 @@
+from django.db import models
+from django.utils.translation import ugettext_lazy as _
+from django.core.exceptions import ValidationError
+from django.core.urlresolvers import reverse
+
+
+USED_POLLS_KEY = 'used_polls'
+
+
+class Poll(models.Model):
+
+    question = models.TextField(_('question'))
+    slug = models.SlugField(_('slug'))
+    open = models.BooleanField(_('open'), default = False)
+    
+    class Meta:
+        verbose_name = _('Poll')
+        verbose_name_plural = _('Polls')
+    
+    def clean(self):
+        if self.open and Poll.objects.exclude(pk = self.pk).filter(slug = self.slug).exists():
+            raise ValidationError(_('Slug of an open poll needs to be unique'))
+        return super(Poll, self).clean()
+        
+    def __unicode__(self):
+        return self.question[:100] + ' (' + self.slug + ')'
+        
+    def get_absolute_url(self):
+        return reverse('poll', args = [self.slug])
+        
+    @property
+    def vote_count(self):
+        return self.items.all().aggregate(models.Sum('vote_count'))['vote_count__sum']
+        
+    def voted(self, session):
+        return self.id in session.get(USED_POLLS_KEY, set())
+
+        
+class PollItem(models.Model):
+    
+    poll = models.ForeignKey(Poll, related_name = 'items')
+    content = models.TextField(_('content'))
+    vote_count = models.IntegerField(_('vote count'), default = 0)
+    
+    class Meta:
+        verbose_name = _('vote item')
+        verbose_name_plural = _('vote items')
+        \r
+    def __unicode__(self):
+        return self.content + ' @ ' + unicode(self.poll)
+    
+    @property
+    def vote_ratio(self):
+        return (float(self.vote_count) / self.poll.vote_count) * 100 if self.poll.vote_count else 0
+        
+    def vote(self, session):
+        self.vote_count = self.vote_count + 1
+        self.save()
+        session.setdefault(USED_POLLS_KEY, set()).add(self.poll.id)
+        session.save()
\ No newline at end of file
diff --git a/apps/polls/static/polls/polls.css b/apps/polls/static/polls/polls.css
new file mode 100644 (file)
index 0000000..0dd10fa
--- /dev/null
@@ -0,0 +1 @@
+.poll{width:400px}.poll ul{list-style-type:none}.poll-bar{border:solid 1px #ddd;height:6px;margin-bottom:10px}.poll-bar-inner{background:orange;height:6px}.poll-msg{font-weight:bold}
\ No newline at end of file
diff --git a/apps/polls/static/polls/polls.scss b/apps/polls/static/polls/polls.scss
new file mode 100644 (file)
index 0000000..28cd5a5
--- /dev/null
@@ -0,0 +1,21 @@
+.poll {\r
+    width: 400px;\r
+    ul {\r
+        list-style-type: none;\r
+    }\r
+}\r
+\r
+.poll-bar {\r
+    border: solid 1px #ddd;\r
+    height:6px;\r
+    margin-bottom: 10px;\r
+}\r
+\r
+.poll-bar-inner {\r
+    background: orange;\r
+    height: 6px;\r
+}\r
+\r
+.poll-msg {\r
+    font-weight: bold;\r
+}
\ No newline at end of file
diff --git a/apps/polls/templates/polls/poll.html b/apps/polls/templates/polls/poll.html
new file mode 100644 (file)
index 0000000..edb14cf
--- /dev/null
@@ -0,0 +1,15 @@
+{% extends "base.html" %}
+{% load i18n %}
+{% load polls_tags %}
+
+{% block titleextra %}{{poll.question}}{% endblock %}
+
+
+{% block body %}
+    <div class="normal-text">
+        {% if voted_already %}
+            <p class="poll-msg">{% trans "Thanks for voting! You can see current results below." %}</p>
+        {% endif %}
+        {% poll poll %}
+    </div>
+{% endblock %}
\ No newline at end of file
diff --git a/apps/polls/templates/polls/tags/poll.html b/apps/polls/templates/polls/tags/poll.html
new file mode 100644 (file)
index 0000000..8566a9d
--- /dev/null
@@ -0,0 +1,27 @@
+{% load i18n %}
+
+{% if poll %}
+    {% if voted_already %}
+        {% if show_results %}
+            <div class="poll">
+                <p>{{poll.question}}</p>
+                <ul>
+                {% for item in poll.items.all %}
+                    <li>
+                        {{item.content}}
+                        <div class="poll-bar"><div class="poll-bar-inner" style="width:{{item.vote_ratio|stringformat:"f"}}%;"></div>
+                    </li>
+                {% endfor %}
+                </ul>
+            </div>
+        {% endif %}
+    {% else %}
+        <div class="poll">
+            <p>{{poll.question}}</p>
+            <form action="{{poll.get_absolute_url}}" method="post">{% csrf_token %}
+            {{ form.vote }}
+            <input type="submit" value="{% trans "Submit" %}" />
+            </form>
+        </div>
+    {% endif %}
+{% endif %}
\ No newline at end of file
diff --git a/apps/polls/templatetags/__init__.py b/apps/polls/templatetags/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/apps/polls/templatetags/polls_tags.py b/apps/polls/templatetags/polls_tags.py
new file mode 100644 (file)
index 0000000..e69a7ce
--- /dev/null
@@ -0,0 +1,18 @@
+from django import template
+from ..forms import PollForm
+
+
+register = template.Library()
+
+@register.inclusion_tag('polls/tags/poll.html', takes_context = True)
+def poll(context, poll, show_results = True, redirect_to = ''):
+    form = None
+    voted_already = poll.voted(context.get('request').session)
+    if not voted_already:
+        form = PollForm(poll = poll, initial = dict(redirect_to = redirect_to))
+    return dict(poll = poll,
+                form = form,
+                voted_already = voted_already,
+                vote_count = poll.vote_count,
+                show_results = show_results
+           )
\ No newline at end of file
diff --git a/apps/polls/urls.py b/apps/polls/urls.py
new file mode 100644 (file)
index 0000000..87738d5
--- /dev/null
@@ -0,0 +1,6 @@
+from django.conf.urls import patterns, url, include
+
+
+urlpatterns = patterns('polls.views',
+    url(r'^(?P<slug>[^/]+)$', 'poll', name='poll'),
+)
diff --git a/apps/polls/views.py b/apps/polls/views.py
new file mode 100644 (file)
index 0000000..c9cb5de
--- /dev/null
@@ -0,0 +1,34 @@
+from django.views.decorators.http import require_http_methods\r
+from django.shortcuts import get_object_or_404, redirect, render_to_response\r
+from django.core.urlresolvers import reverse\r
+from django.template import RequestContext
+
+from models import Poll, PollItem\r
+from forms import PollForm
+
+\r
+@require_http_methods(['GET', 'POST'])\r
+def poll(request, slug):
+    
+    poll = get_object_or_404(Poll, slug = slug, open = True)
+    
+    if request.method == 'POST':\r
+        redirect_to = reverse('poll', args = [slug])
+        form = PollForm(request.POST, poll = poll)\r
+        if form.is_valid():\r
+            if not poll.voted(request.session):\r
+                try:\r
+                    poll_item = PollItem.objects.filter(pk = form.cleaned_data['vote'], poll = poll).get()
+                except PollItem.DoesNotExist:\r
+                    pass\r
+                else:\r
+                    poll_item.vote(request.session)
+        return redirect(redirect_to)
+    elif request.method == 'GET':
+        context = RequestContext(request)
+        context['poll'] = poll\r
+        context['voted_already'] = poll.voted(request.session)
+        return render_to_response('polls/poll.html', context)
+        
+        \r
+            
\ No newline at end of file
index 5c29ef0..3496937 100755 (executable)
@@ -58,11 +58,19 @@ ul.plain {
 }
 
 h2 {
+    font-size: 2em;
+    font-weight: normal;
+}
+
+h2.plain {
     margin: 0;
     font-size: 1em;
-    font-weight: normal;
 }
 
+h3 {
+    font-size: 1.5em;
+    font-weight: normal;
+}
 
 .mono {
     font-family: "Andale Mono", "Lucida Sans Typewriter", "Courier New";
index 74b710a..190ddd7 100755 (executable)
@@ -286,6 +286,11 @@ ul.inline-items li {
 .book-wide-box .other-download ul {
        font-size: 1.1em;
 }
+.book-wide-box .other-tools h2,
+.book-wide-box .other-download h2 {
+    margin: 0;
+}
+
 
 
 .book-wide-box .license-icon {
index 0e952ba..5f52f24 100755 (executable)
     list-style: none;
 }
 
+#book-a-list #book-list h2 {
+    font-size: 1em;
+    margin: 0;
+}
+
 #book-a-list #book-list h2 a {
     color: black;
 }
@@ -66,6 +71,7 @@
 
 .catalogue-catalogue h2 {
     font-size: 2em;
+    margin: 0;
 }
 .catalogue-catalogue ul {
     column-width: 30em;
 }
 .see-also h2, .download h2 {
     font-size: 1.1em;
+    margin: 0;
 }
 .see-also ul, .download ul {
     list-style: none;
index b5e4432..514f8af 100644 (file)
@@ -1,3 +1,3 @@
-@import url("screen.css");
-@import url("antiscreen.css") handheld;
-@import url("antiscreen.css") only screen and (max-device-width:480px);
+@import url(screen.css);
+@import url(antiscreen.css) handheld;
+@import url(antiscreen.css) only screen and (max-device-width:480px);
diff --git a/apps/wolnelektury_core/static/css/form.css b/apps/wolnelektury_core/static/css/form.css
new file mode 100644 (file)
index 0000000..65d0482
--- /dev/null
@@ -0,0 +1 @@
+form table th{vertical-align:top;text-align:left;font-weight:normal}form table td{padding-bottom:1em}form table .required th:after{content:" *"}form table .errorlist{color:red;margin:0;padding:0;list-style:none}form table .helptext{color:#888;font-size:.9em;font-style:italic}
\ No newline at end of file
diff --git a/apps/wolnelektury_core/static/css/form.scss b/apps/wolnelektury_core/static/css/form.scss
new file mode 100644 (file)
index 0000000..42e8675
--- /dev/null
@@ -0,0 +1,26 @@
+form table {
+    th {
+        vertical-align: top;
+        text-align: left;
+        font-weight: normal;
+    }
+    td {
+        padding-bottom: 1em;
+    }
+
+    .required th:after {
+        content: " *";
+    }
+
+    .errorlist {
+        color: red;
+        margin: 0;
+        padding: 0;
+        list-style: none;
+    }
+    .helptext {
+        color: #888;
+        font-size: .9em;
+        font-style: italic;
+    }
+}
index 633e8bd..f1bd0df 100755 (executable)
@@ -25,6 +25,9 @@
     color: #989898;
 }
 
+#logo a, #logo img {
+    display: block;
+}
 
 #tagline {
        margin-left: 1.5em;
index 3761b9e..4bf75ea 100755 (executable)
@@ -10,6 +10,7 @@
 }
 #promo-box-header h2 {
     font-size: 1.3em;
+    margin: 0;
 }
 #promo-box-body {
     border-bottom: 2px solid #efefef;
@@ -45,6 +46,8 @@
     padding-top: 1.9em;
     height: 3.2em;
     padding-left: 1.9em;
+    margin: 0;
+    font-size: 1em;
 }
 .main-last span {
     font-size: 1.1em;
@@ -67,6 +70,8 @@
     color: #017e85;
     height: 2.8em;
     padding-top: 2.5em;
+    font-size: 1em;
+    margin: 0;
 }
 .infopages-box h2 span {
     font-size: 1.1em;
diff --git a/apps/wolnelektury_core/static/img/progress-pixel.png b/apps/wolnelektury_core/static/img/progress-pixel.png
new file mode 100644 (file)
index 0000000..5af1bfd
Binary files /dev/null and b/apps/wolnelektury_core/static/img/progress-pixel.png differ
diff --git a/apps/wolnelektury_core/static/img/social/bigfacebook.png b/apps/wolnelektury_core/static/img/social/bigfacebook.png
new file mode 100644 (file)
index 0000000..630416c
Binary files /dev/null and b/apps/wolnelektury_core/static/img/social/bigfacebook.png differ
diff --git a/apps/wolnelektury_core/static/img/social/biggoogle.png b/apps/wolnelektury_core/static/img/social/biggoogle.png
new file mode 100644 (file)
index 0000000..19ad19d
Binary files /dev/null and b/apps/wolnelektury_core/static/img/social/biggoogle.png differ
diff --git a/apps/wolnelektury_core/static/img/social/bignk.png b/apps/wolnelektury_core/static/img/social/bignk.png
new file mode 100644 (file)
index 0000000..c119cd1
Binary files /dev/null and b/apps/wolnelektury_core/static/img/social/bignk.png differ
diff --git a/apps/wolnelektury_core/static/img/social/bigtwitter.png b/apps/wolnelektury_core/static/img/social/bigtwitter.png
new file mode 100644 (file)
index 0000000..fafbe64
Binary files /dev/null and b/apps/wolnelektury_core/static/img/social/bigtwitter.png differ
index 3eaf962..a338b97 100644 (file)
@@ -2,7 +2,7 @@
 <html lang="{{ LANGUAGE_CODE }}" prefix="og: http://ogp.me/ns# fb: http://ogp.me/ns/fb#">
        {% load cache compressed i18n %}
        {% load static from staticfiles %}
-    {% load catalogue_tags reporting_stats sponsor_tags %}
+    {% load catalogue_tags funding_tags reporting_stats sponsor_tags %}
     <head>
         <meta charset="utf-8">
         <meta name="application-name" content="Wolne Lektury" />
@@ -34,7 +34,7 @@
     <body id="{% block bodyid %}base{% endblock %}">
 
         {% block bodycontent %}
-
+        {% funding link=1 closeable=1 add_class="funding-top-header" %}
                <div id="header-bg"></div>
 
         <div id="header">
         </div>
 
 
-
         <div id="main-content">
-
+            
             <div id="nav-line">
                 {% catalogue_menu %}
 
index ae582ce..77cd016 100644 (file)
@@ -91,10 +91,10 @@ def logout_then_redirect(request):
 
 @never_cache
 def clock(request):
-    """ Provides server time for jquery.countdown,
+    """ Provides server UTC time for jquery.countdown,
     in a format suitable for Date.parse()
     """
-    return HttpResponse(datetime.now().strftime('%Y/%m/%d %H:%M:%S'))
+    return HttpResponse(datetime.utcnow().strftime('%Y/%m/%d %H:%M:%S UTC'))
 
 
 def publish_plan(request):
diff --git a/lib/pyscss_compiler.py b/lib/pyscss_compiler.py
new file mode 100644 (file)
index 0000000..b57d59e
--- /dev/null
@@ -0,0 +1,19 @@
+from os.path import dirname
+from django.conf import settings
+from pipeline.compilers import SubProcessCompiler
+
+
+class PySCSSCompiler(SubProcessCompiler):
+    output_extension = 'css'
+
+    def match_file(self, filename):
+        return filename.endswith('.scss')
+
+    def compile_file(self, infile, outfile, outdated=False, force=False):
+        command = "%s %s < %s > %s" % (
+            settings.PIPELINE_PYSCSS_BINARY,
+            settings.PIPELINE_PYSCSS_ARGUMENTS,
+            infile,
+            outfile
+        )
+        return self.execute_command(command, cwd=dirname(infile))
index 5b422ec..572251a 100644 (file)
@@ -5,7 +5,7 @@
 Django>=1.5,<1.6
 fnpdjango>=0.1.6,<0.2
 South>=0.7 # migrations for django
-django-pipeline>=1.2,<1.3
+django-pipeline>=1.2.24,<1.3
 django-pagination>=1.0
 django-maintenancemode>=0.10
 django-piston>=0.2.2.1,<0.2.3
@@ -15,6 +15,9 @@ django-picklefield
 #django-allauth<0.10 with migration fix
 -e git+git://github.com/rczajka/django-allauth.git@4ecda71b81f9311dea4febe1d2d0105f23c642c7#egg=django-allauth
 
+pytz
+pyScss
+
 # Some contrib apps still need it
 simplejson
 
@@ -40,7 +43,7 @@ lxml>=2.2.2
 # MySQL-python>=1.2,<2.0
 
 # celery tasks
-django-celery>=2.5.1
+django-celery>=3.0.11
 django-kombu
 
 # spell checking
@@ -51,3 +54,5 @@ pyoai
 
 egenix-mx-base
 sunburnt
+
+django-getpaid>=1.4,<1.5
diff --git a/wolnelektury/migrations/__init__.py b/wolnelektury/migrations/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/wolnelektury/migrations/getpaid/0001_initial.py b/wolnelektury/migrations/getpaid/0001_initial.py
new file mode 100644 (file)
index 0000000..a4a5280
--- /dev/null
@@ -0,0 +1,104 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding model 'Payment'
+        db.create_table(u'getpaid_payment', (
+            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+            ('amount', self.gf('django.db.models.fields.DecimalField')(max_digits=20, decimal_places=4)),
+            ('currency', self.gf('django.db.models.fields.CharField')(max_length=3)),
+            ('status', self.gf('django.db.models.fields.CharField')(default='new', max_length=20, db_index=True)),
+            ('backend', self.gf('django.db.models.fields.CharField')(max_length=50)),
+            ('created_on', self.gf('django.db.models.fields.DateTimeField')(auto_now_add=True, db_index=True, blank=True)),
+            ('paid_on', self.gf('django.db.models.fields.DateTimeField')(default=None, null=True, db_index=True, blank=True)),
+            ('amount_paid', self.gf('django.db.models.fields.DecimalField')(default=0, max_digits=20, decimal_places=4)),
+            ('order', self.gf('django.db.models.fields.related.ForeignKey')(related_name='payment', to=orm['funding.Funding'])),
+        ))
+        db.send_create_signal(u'getpaid', ['Payment'])
+
+
+    def backwards(self, orm):
+        # Deleting model 'Payment'
+        db.delete_table(u'getpaid_payment')
+
+
+    models = {
+        'catalogue.book': {
+            'Meta': {'ordering': "('sort_key',)", 'object_name': 'Book'},
+            '_related_info': ('jsonfield.fields.JSONField', [], {'null': 'True', 'blank': 'True'}),
+            'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'common_slug': ('django.db.models.fields.SlugField', [], {'max_length': '120'}),
+            'cover': ('catalogue.fields.EbookField', [], {'max_length': '100', 'null': 'True', 'format_name': "'cover'", 'blank': 'True'}),
+            'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'epub_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'epub'", 'blank': 'True'}),
+            'extra_info': ('jsonfield.fields.JSONField', [], {'default': "'{}'"}),
+            'fb2_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'fb2'", 'blank': 'True'}),
+            'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'html_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'html'", 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'language': ('django.db.models.fields.CharField', [], {'default': "'pol'", 'max_length': '3', 'db_index': 'True'}),
+            'mobi_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'mobi'", 'blank': 'True'}),
+            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}),
+            'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'pdf_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'pdf'", 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120'}),
+            'sort_key': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
+            'txt_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'txt'", 'blank': 'True'}),
+            'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'xml_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'xml'", 'blank': 'True'})
+        },
+        u'funding.funding': {
+            'Meta': {'ordering': "['-payed_at']", 'object_name': 'Funding'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'anonymous': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '127', 'blank': 'True'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']"}),
+            'payed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'perks': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['funding.Perk']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        u'funding.offer': {
+            'Meta': {'ordering': "['-end']", 'object_name': 'Offer'},
+            'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']", 'null': 'True', 'blank': 'True'}),
+            'due': ('django.db.models.fields.DateField', [], {}),
+            'end': ('django.db.models.fields.DateField', [], {}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'redakcja_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
+            'start': ('django.db.models.fields.DateField', [], {}),
+            'target': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        u'funding.perk': {
+            'Meta': {'ordering': "['-price']", 'object_name': 'Perk'},
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']", 'null': 'True', 'blank': 'True'}),
+            'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'})
+        },
+        u'getpaid.payment': {
+            'Meta': {'ordering': "('-created_on',)", 'object_name': 'Payment'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '20', 'decimal_places': '4'}),
+            'amount_paid': ('django.db.models.fields.DecimalField', [], {'default': '0', 'max_digits': '20', 'decimal_places': '4'}),
+            'backend': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
+            'created_on': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'currency': ('django.db.models.fields.CharField', [], {'max_length': '3'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'order': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'payment'", 'to': u"orm['funding.Funding']"}),
+            'paid_on': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'status': ('django.db.models.fields.CharField', [], {'default': "'new'", 'max_length': '20', 'db_index': 'True'})
+        }
+    }
+
+    complete_apps = ['getpaid']
\ No newline at end of file
diff --git a/wolnelektury/migrations/getpaid/0002_auto__add_field_payment_external_id__add_field_payment_description.py b/wolnelektury/migrations/getpaid/0002_auto__add_field_payment_external_id__add_field_payment_description.py
new file mode 100644 (file)
index 0000000..c017e3c
--- /dev/null
@@ -0,0 +1,106 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        # Adding field 'Payment.external_id'
+        db.add_column(u'getpaid_payment', 'external_id',
+                      self.gf('django.db.models.fields.CharField')(max_length=64, null=True, blank=True),
+                      keep_default=False)
+
+        # Adding field 'Payment.description'
+        db.add_column(u'getpaid_payment', 'description',
+                      self.gf('django.db.models.fields.CharField')(max_length=128, null=True, blank=True),
+                      keep_default=False)
+
+
+    def backwards(self, orm):
+        # Deleting field 'Payment.external_id'
+        db.delete_column(u'getpaid_payment', 'external_id')
+
+        # Deleting field 'Payment.description'
+        db.delete_column(u'getpaid_payment', 'description')
+
+
+    models = {
+        'catalogue.book': {
+            'Meta': {'ordering': "('sort_key',)", 'object_name': 'Book'},
+            '_related_info': ('jsonfield.fields.JSONField', [], {'null': 'True', 'blank': 'True'}),
+            'changed_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'common_slug': ('django.db.models.fields.SlugField', [], {'max_length': '120'}),
+            'cover': ('catalogue.fields.EbookField', [], {'max_length': '100', 'null': 'True', 'format_name': "'cover'", 'blank': 'True'}),
+            'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'epub_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'epub'", 'blank': 'True'}),
+            'extra_info': ('jsonfield.fields.JSONField', [], {'default': "'{}'"}),
+            'fb2_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'fb2'", 'blank': 'True'}),
+            'gazeta_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'html_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'html'", 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'language': ('django.db.models.fields.CharField', [], {'default': "'pol'", 'max_length': '3', 'db_index': 'True'}),
+            'mobi_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'mobi'", 'blank': 'True'}),
+            'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['catalogue.Book']"}),
+            'parent_number': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
+            'pdf_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'pdf'", 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '120'}),
+            'sort_key': ('django.db.models.fields.CharField', [], {'max_length': '120', 'db_index': 'True'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '120'}),
+            'txt_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'txt'", 'blank': 'True'}),
+            'wiki_link': ('django.db.models.fields.CharField', [], {'max_length': '240', 'blank': 'True'}),
+            'xml_file': ('catalogue.fields.EbookField', [], {'default': "''", 'max_length': '100', 'format_name': "'xml'", 'blank': 'True'})
+        },
+        u'funding.funding': {
+            'Meta': {'ordering': "['-payed_at']", 'object_name': 'Funding'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '127', 'blank': 'True'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']"}),
+            'payed_at': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+            'perks': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['funding.Perk']", 'symmetrical': 'False', 'blank': 'True'})
+        },
+        u'funding.offer': {
+            'Meta': {'ordering': "['-end']", 'object_name': 'Offer'},
+            'author': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'book': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['catalogue.Book']", 'null': 'True', 'blank': 'True'}),
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'due': ('django.db.models.fields.DateField', [], {}),
+            'end': ('django.db.models.fields.DateField', [], {}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'redakcja_url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'blank': 'True'}),
+            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}),
+            'start': ('django.db.models.fields.DateField', [], {}),
+            'target': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'}),
+            'title': ('django.db.models.fields.CharField', [], {'max_length': '255'})
+        },
+        u'funding.perk': {
+            'Meta': {'ordering': "['-price']", 'object_name': 'Perk'},
+            'description': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
+            'end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
+            'offer': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['funding.Offer']", 'null': 'True', 'blank': 'True'}),
+            'price': ('django.db.models.fields.DecimalField', [], {'max_digits': '10', 'decimal_places': '2'})
+        },
+        u'getpaid.payment': {
+            'Meta': {'ordering': "('-created_on',)", 'object_name': 'Payment'},
+            'amount': ('django.db.models.fields.DecimalField', [], {'max_digits': '20', 'decimal_places': '4'}),
+            'amount_paid': ('django.db.models.fields.DecimalField', [], {'default': '0', 'max_digits': '20', 'decimal_places': '4'}),
+            'backend': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
+            'created_on': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'currency': ('django.db.models.fields.CharField', [], {'max_length': '3'}),
+            'description': ('django.db.models.fields.CharField', [], {'max_length': '128', 'null': 'True', 'blank': 'True'}),
+            'external_id': ('django.db.models.fields.CharField', [], {'max_length': '64', 'null': 'True', 'blank': 'True'}),
+            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+            'order': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'payment'", 'to': u"orm['funding.Funding']"}),
+            'paid_on': ('django.db.models.fields.DateTimeField', [], {'default': 'None', 'null': 'True', 'db_index': 'True', 'blank': 'True'}),
+            'status': ('django.db.models.fields.CharField', [], {'default': "'new'", 'max_length': '20', 'db_index': 'True'})
+        }
+    }
+
+    complete_apps = ['getpaid']
\ No newline at end of file
diff --git a/wolnelektury/migrations/getpaid/__init__.py b/wolnelektury/migrations/getpaid/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/wolnelektury/migrations/getpaid_payu/0001_initial.py b/wolnelektury/migrations/getpaid_payu/0001_initial.py
new file mode 100644 (file)
index 0000000..b8b2b79
--- /dev/null
@@ -0,0 +1,20 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+    def forwards(self, orm):
+        pass
+
+    def backwards(self, orm):
+        pass
+
+    models = {
+        
+    }
+
+    complete_apps = ['payu']
\ No newline at end of file
diff --git a/wolnelektury/migrations/getpaid_payu/__init__.py b/wolnelektury/migrations/getpaid_payu/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
index caec10b..8d7c00f 100644 (file)
@@ -65,9 +65,15 @@ INSTALLED_APPS_OUR = [
     'waiter',
     'search',
     'oai',
+    'funding',
+    'polls',
     'libraries',
     ]
 
+GETPAID_BACKENDS = (
+    'getpaid.backends.payu',
+)
+
 INSTALLED_APPS_CONTRIB = [
     # external
     'django.contrib.auth',
@@ -88,6 +94,9 @@ INSTALLED_APPS_CONTRIB = [
     'djkombu',
     'honeypot',
     #'django_nose',
+    'fnpdjango',
+    'getpaid',
+    'getpaid.backends.payu',
 
     #allauth stuff
     'uni_form',
index 6ceed8d..30812e5 100644 (file)
@@ -30,6 +30,7 @@ SOLR_TEST = "http://localhost:8983/solr/wl_test/"
 # If running in a Windows environment this must be set to the same as your
 # system time zone.
 TIME_ZONE = 'Europe/Warsaw'
+USE_TZ = True
 
 SITE_ID = 1
 
index 654066a..6e3e535 100644 (file)
@@ -2,3 +2,8 @@ HONEYPOT_FIELD_NAME = 'miut'
 PAGINATION_INVALID_PAGE_RAISES_404 = True
 THUMBNAIL_QUALITY = 95
 TRANSLATION_REGISTRY = "wolnelektury.translation"
+
+SOUTH_MIGRATION_MODULES = {
+    'getpaid' : 'wolnelektury.migrations.getpaid',
+    'payu': 'wolnelektury.migrations.getpaid_payu',
+}
index a0bab7a..8e2489d 100644 (file)
@@ -16,3 +16,5 @@ CATALOGUE_CUSTOMPDF_RATE_LIMIT = '1/m'
 # set to 'new' or 'old' to skip time-consuming test
 # for TeX morefloats library version
 LIBRARIAN_PDF_MOREFLOATS = None
+
+FUNDING_DEFAULT = 20
index 7b951fb..5069051 100644 (file)
@@ -5,6 +5,7 @@ from .paths import PROJECT_DIR
 # If you set this to False, Django will make some optimizations so as not
 # to load the internationalization machinery.
 USE_I18N = True
+USE_L10N = True
 
 LOCALE_PATHS = [
     path.join(PROJECT_DIR, 'locale-contrib')
index 2ed7b38..a3ff424 100644 (file)
@@ -30,6 +30,9 @@ PIPELINE_CSS = {
             'css/catalogue.css',
             'sponsors/css/sponsors.css',
             'css/auth.css',
+            'funding/funding.scss',
+            'polls/polls.scss',
+            'css/form.scss',
 
             'css/social/shelf_tags.css',
             'css/ui-lightness/jquery-ui-1.8.16.custom.css',
@@ -81,6 +84,7 @@ PIPELINE_JS = {
             'sponsors/js/sponsors.js',
             'player/openplayer.js',
             'js/search.js',
+            'funding/funding.js',
             ),
         'output_filename': 'js/base.min.js',
     },
@@ -112,3 +116,9 @@ PIPELINE_JS = {
 STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
 PIPELINE_CSS_COMPRESSOR = None
 PIPELINE_JS_COMPRESSOR = None
+
+PIPELINE_COMPILERS = (
+    'pyscss_compiler.PySCSSCompiler',
+)
+PIPELINE_PYSCSS_BINARY = '/usr/bin/env pyscss'
+PIPELINE_PYSCSS_ARGUMENTS = ''
index e99b081..6c25451 100644 (file)
@@ -35,6 +35,8 @@ urlpatterns += patterns('',
     url(r'^ludzie/', include('social.urls')),
     url(r'^uzytkownik/', include('allauth.urls')),
     url(r'^czekaj/', include('waiter.urls')),
+    url(r'^wesprzyj/', include('funding.urls')),
+    url(r'^ankieta/', include('polls.urls')),
     url(r'^biblioteki', include('libraries.urls')),
 
     # Admin panel
diff --git a/wolnelektury/utils.py b/wolnelektury/utils.py
new file mode 100644 (file)
index 0000000..ad57222
--- /dev/null
@@ -0,0 +1,11 @@
+import pytz
+from django.utils import timezone
+from django.conf import settings
+
+def localtime_to_utc(localtime):
+    return timezone.utc.normalize(
+        pytz.timezone(settings.TIME_ZONE).localize(localtime)
+    )
+
+def utc_for_js(dt):
+    return dt.strftime('%Y/%m/%d %H:%M:%S UTC')