Basically usable funding workflow.
authorRadek Czajka <radek.czajka@gmail.com>
Wed, 27 Mar 2013 16:11:51 +0000 (17:11 +0100)
committerRadek Czajka <radek.czajka@gmail.com>
Wed, 27 Mar 2013 16:11:51 +0000 (17:11 +0100)
24 files changed:
apps/funding/forms.py
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/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/models.py
apps/funding/static/funding/funding.css
apps/funding/static/funding/funding.scss
apps/funding/templates/funding/offer_detail.html
apps/funding/templates/funding/offer_list.html
apps/funding/templates/funding/tags/funding.html
apps/funding/templates/funding/tags/offer_detail_head.html [new file with mode: 0644]
apps/funding/templates/funding/thanks.html
apps/funding/templates/funding/widgets/amount.html [new file with mode: 0644]
apps/funding/templates/funding/wlfund.html
apps/funding/templatetags/funding_tags.py
apps/funding/views.py
apps/funding/widgets.py [new file with mode: 0644]
apps/wolnelektury_core/static/css/form.css [new file with mode: 0644]
apps/wolnelektury_core/static/css/form.scss [new file with mode: 0644]
lib/pyscss_compiler.py [new file with mode: 0644]
requirements.txt
wolnelektury/settings/custom.py
wolnelektury/settings/static.py

index eb75fb6..6b2316e 100755 (executable)
@@ -1,30 +1,41 @@
 from django import forms
 from django import forms
+from django.utils.translation import ugettext_lazy as _, ugettext as __
 from .models import Offer
 from .models import Offer
+from .widgets import PerksAmountWidget
 
 
 class DummyForm(forms.Form):
 
 
 class DummyForm(forms.Form):
-    amount = forms.DecimalField()
-    name = forms.CharField()
-    email = forms.EmailField()
+    required_css_class = 'required'
+
+    name = forms.CharField(label=_("Name"))
+    anonymous = forms.BooleanField(label=_("Anonymously"),
+        required=False,
+        help_text=_("Check if you don't want your name to be visible publicly."))
+    email = forms.EmailField(label=_("E-mail"),
+        help_text=_("Won't be publicised."))
+    amount = forms.DecimalField(label=_("Amount"), decimal_places=2,
+        widget=PerksAmountWidget())
 
     def __init__(self, offer, *args, **kwargs):
         self.offer = offer
         super(DummyForm, self).__init__(*args, **kwargs)
 
     def __init__(self, offer, *args, **kwargs):
         self.offer = offer
         super(DummyForm, self).__init__(*args, **kwargs)
+        self.fields['amount'].widget.form_instance = self
 
     def clean_amount(self):
         if self.cleaned_data['amount'] <= 0:
 
     def clean_amount(self):
         if self.cleaned_data['amount'] <= 0:
-            raise forms.ValidationError("A!")
+            raise forms.ValidationError(__("Enter positive amount."))
         return self.cleaned_data['amount']
 
     def clean(self):
         return self.cleaned_data['amount']
 
     def clean(self):
-        if self.offer != Offer.current():
-            raise forms.ValidationError("B!")
+        if not self.offer.is_current():
+            raise forms.ValidationError(__("This offer is out of date."))
         return self.cleaned_data
 
     def save(self):
         return self.cleaned_data
 
     def save(self):
-        print self.cleaned_data
         return self.offer.fund(
             name=self.cleaned_data['name'],
             email=self.cleaned_data['email'],
         return self.offer.fund(
             name=self.cleaned_data['name'],
             email=self.cleaned_data['email'],
-            amount=self.cleaned_data['amount'])
+            amount=self.cleaned_data['amount'],
+            anonymous=self.cleaned_data['anonymous'],
+        )
 
 
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..537a35f
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..3e3e62a
--- /dev/null
@@ -0,0 +1,265 @@
+# 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-03-27 17:10+0100\n"
+"PO-Revision-Date: 2013-03-27 17:10+0100\n"
+"Last-Translator: Radek Czajka <radek.czajka@gmail.com>\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
+msgid "Name"
+msgstr "Imię i nazwisko"
+
+#: forms.py:11
+msgid "Anonymously"
+msgstr "Anonimowo"
+
+#: forms.py:13
+msgid "Check if you don't want your name to be visible publicly."
+msgstr "Zaznacz, jeśli nie chcesz by Twoje nazwisko było widoczne publicznie."
+
+#: forms.py:14
+msgid "E-mail"
+msgstr "E-mail"
+
+#: forms.py:15
+msgid "Won't be publicised."
+msgstr "Nie zostanie opublikowany."
+
+#: forms.py:16
+msgid "Amount"
+msgstr "Kwota"
+
+#: models.py:13
+msgid "author"
+msgstr "autor"
+
+#: models.py:14
+msgid "title"
+msgstr "tytuł"
+
+#: models.py:15
+msgid "slug"
+msgstr "slug"
+
+#: models.py:17
+msgid "Published book."
+msgstr "Opublikowana książka."
+
+#: models.py:18
+msgid "redakcja URL"
+msgstr "URL na Redakcji"
+
+#: models.py:19
+msgid "target"
+msgstr "kwota docelowa"
+
+#: models.py:20
+msgid "start"
+msgstr "początek"
+
+#: models.py:21
+msgid "end"
+msgstr "koniec"
+
+#: models.py:22
+msgid "due"
+msgstr "data publikacji"
+
+#: models.py:23
+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:26
+#: models.py:82
+#: models.py:97
+msgid "offer"
+msgstr "zbiórka"
+
+#: models.py:27
+msgid "offers"
+msgstr "zbiórki"
+
+#: models.py:83
+msgid "price"
+msgstr "cena"
+
+#: models.py:84
+#: models.py:98
+msgid "name"
+msgstr "nazwa"
+
+#: models.py:85
+msgid "description"
+msgstr "opis"
+
+#: models.py:88
+msgid "perk"
+msgstr "prezent"
+
+#: models.py:89
+#: models.py:102
+msgid "perks"
+msgstr "prezenty"
+
+#: models.py:99
+msgid "email"
+msgstr "e-mail"
+
+#: models.py:100
+#: models.py:115
+msgid "amount"
+msgstr "kwota"
+
+#: models.py:101
+msgid "payed at"
+msgstr "data wpłaty"
+
+#: models.py:103
+msgid "anonymous"
+msgstr "anonimowo"
+
+#: models.py:106
+msgid "funding"
+msgstr "wpłata"
+
+#: models.py:107
+msgid "fundings"
+msgstr "wpłaty"
+
+#: models.py:116
+msgid "when"
+msgstr "kiedy"
+
+#: models.py:120
+msgid "money spent on a book"
+msgstr "pieniądze wydane na książkę"
+
+#: models.py:121
+msgid "money spent on books"
+msgstr "pieniądze wydane na książki"
+
+#: templates/funding/offer_detail.html:22
+msgid "Support"
+msgstr "Wesprzyj"
+
+#: templates/funding/offer_detail.html:39
+msgid "Supporters"
+msgstr "Wpłaty"
+
+#: templates/funding/offer_detail.html:49
+msgid "Anonymous"
+msgstr "Anonim"
+
+#: templates/funding/offer_list.html:6
+#: templates/funding/offer_list.html:9
+msgid "Support Wolne Lektury"
+msgstr "Wspieraj Wolne Lektury"
+
+#: templates/funding/offer_list.html:16
+msgid "funding closed"
+msgstr "zbiórka zakończona"
+
+#: templates/funding/thanks.html:5
+#: templates/funding/thanks.html.py:9
+msgid "Thank you!"
+msgstr "Dziękujemy!"
+
+#: templates/funding/thanks.html:12
+msgid "Thank you for your support!"
+msgstr "Dziękujemy za Twoje wsparcie!"
+
+#: templates/funding/thanks.html:14
+msgid "Go back to the current fundraiser."
+msgstr "Wróć do aktualnej zbiórki."
+
+#: templates/funding/wlfund.html:4
+#: templates/funding/wlfund.html.py:8
+msgid "Wolne Lektury Fund"
+msgstr "Fundusz Wolnych Lektur"
+
+#: templates/funding/wlfund.html:14
+msgid "Balance"
+msgstr "Bilans"
+
+#: templates/funding/wlfund.html:26
+msgid "Book"
+msgstr "Książka"
+
+#: templates/funding/wlfund.html:34
+msgid "Money from partial fundraiser"
+msgstr "Pieniądze z częściowej zbiórki"
+
+#: templates/funding/tags/funding.html:10
+msgid "Support a book:"
+msgstr "Wesprzyj książkę:"
+
+#: templates/funding/tags/funding.html:14
+msgid "collected"
+msgstr "zebrane"
+
+#: templates/funding/tags/funding.html:16
+msgid "until fundraiser end"
+msgstr "do końca zbiórki"
+
+#: templates/funding/tags/offer_detail_head.html:5
+#, python-format
+msgid ""
+"If the target is met\n"
+"        by %(end)s, this book will be published by %(due)s."
+msgstr "Jeśli do %(end)s uda się zebrać pełną kwotę, książka zostanie opublikowana do %(due)s."
+
+#: templates/funding/tags/offer_detail_head.html:10
+#, python-format
+msgid ""
+"Any excessive money will be transfered to the\n"
+"        <a href=\"%(url)s\">Wolne Lektury Fund</a>."
+msgstr ""
+"Wszelkie pozostałe środki zostaną przekazane na\n"
+"        <a href=\"%(url)s\">Fundusz Wolnych Lektur</a>."
+
+#: templates/funding/tags/offer_detail_head.html:15
+msgid "See the published book:"
+msgstr "Zobacz opublikowaną książkę:"
+
+#: templates/funding/tags/offer_detail_head.html:18
+msgid "Funding target has been met!"
+msgstr "Udało się zebrać pełną kwotę!"
+
+#: templates/funding/tags/offer_detail_head.html:19
+msgid "The book will be published by:"
+msgstr "Książka zostanie opublikowana do"
+
+#: templates/funding/tags/offer_detail_head.html:22
+#, python-format
+msgid "You can follow the work on the <a href=\"%(url)s\">Editorial Platform</a>."
+msgstr "Możesz śledzić prace na <a href=\"%(url)s\">Platformie Redakcyjnej</a>."
+
+#: templates/funding/tags/offer_detail_head.html:28
+msgid "Funding target has not been met."
+msgstr "Nie udało się zebrać pełnej kwoty."
+
+#: templates/funding/tags/offer_detail_head.html:31
+#, python-format
+msgid ""
+"Collected funds have been transfered to the\n"
+"        <a href=\"%(url)s\">Wolne Lektury Fund</a>."
+msgstr ""
+"Zebrane środki zostały przekazane na\n"
+"        <a href=\"%(url)s\">Fundusz Wolnych Lektur</a>."
+
+#: templates/funding/widgets/amount.html:12
+msgid "Other amount"
+msgstr "Inna kwota"
+
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
index 8c1ee9a..579147c 100644 (file)
@@ -13,11 +13,14 @@ class Offer(models.Model):
     author = models.CharField(_('author'), max_length=255)
     title = models.CharField(_('title'), max_length=255)
     slug = models.SlugField(_('slug'))
     author = models.CharField(_('author'), max_length=255)
     title = models.CharField(_('title'), max_length=255)
     slug = models.SlugField(_('slug'))
-    book = models.ForeignKey(Book, null=True, blank=True)
+    book = models.ForeignKey(Book, null=True, blank=True,
+        help_text=_('Published book.'))
     redakcja_url = models.URLField(_('redakcja URL'), blank=True)
     target = models.DecimalField(_('target'), decimal_places=2, max_digits=10)
     start = models.DateField(_('start'))
     end = models.DateField(_('end'))
     redakcja_url = models.URLField(_('redakcja URL'), blank=True)
     target = models.DecimalField(_('target'), decimal_places=2, max_digits=10)
     start = models.DateField(_('start'))
     end = models.DateField(_('end'))
+    due = models.DateField(_('due'),
+        help_text=_('When will it be published if the money is raised.'))
 
     class Meta:
         verbose_name = _('offer')
 
     class Meta:
         verbose_name = _('offer')
@@ -30,6 +33,9 @@ class Offer(models.Model):
     def get_absolute_url(self):
         return reverse('funding_offer', args=[self.slug])
 
     def get_absolute_url(self):
         return reverse('funding_offer', args=[self.slug])
 
+    def is_current(self):
+        return self.start <= date.today() <= self.end
+
     @classmethod
     def current(cls):
         today = date.today()
     @classmethod
     def current(cls):
         today = date.today()
@@ -52,9 +58,10 @@ class Offer(models.Model):
             perks = perks.filter(price__lte=amount)
         return perks
 
             perks = perks.filter(price__lte=amount)
         return perks
 
-    def fund(self, name, email, amount):
+    def fund(self, name, email, amount, anonymous=False):
         funding = self.funding_set.create(
             name=name, email=email, amount=amount,
         funding = self.funding_set.create(
             name=name, email=email, amount=amount,
+            anonymous=anonymous,
             payed_at=datetime.now())
         funding.perks = self.get_perks(amount)
         return funding
             payed_at=datetime.now())
         funding.perks = self.get_perks(amount)
         return funding
@@ -91,8 +98,9 @@ class Funding(models.Model):
     name = models.CharField(_('name'), max_length=127)
     email = models.EmailField(_('email'))
     amount = models.DecimalField(_('amount'), decimal_places=2, max_digits=10)
     name = models.CharField(_('name'), max_length=127)
     email = models.EmailField(_('email'))
     amount = models.DecimalField(_('amount'), decimal_places=2, max_digits=10)
-    payed_at = models.DateTimeField(_('payed_at'))
+    payed_at = models.DateTimeField(_('payed at'))
     perks = models.ManyToManyField(Perk, verbose_name=_('perks'), blank=True)
     perks = models.ManyToManyField(Perk, verbose_name=_('perks'), blank=True)
+    anonymous = models.BooleanField(_('anonymous'))
 
     class Meta:
         verbose_name = _('funding')
 
     class Meta:
         verbose_name = _('funding')
@@ -108,5 +116,10 @@ class Spent(models.Model):
     timestamp = models.DateField(_('when'))
     book = models.ForeignKey(Book)
 
     timestamp = models.DateField(_('when'))
     book = models.ForeignKey(Book)
 
+    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 __unicode__(self):
         return u"Spent: %s" % unicode(self.book)
index 0b3f563..6c3ef37 100755 (executable)
@@ -1,27 +1 @@
-.funding {
-  font-size: 1.5em;
-  padding: 0;
-  padding: .5em 1em;
-  background-image: url(/static/img/green-pixel.png);
-  background-repeat: repeat-y;
-  background-color: rgba(13, 126, 133, 0.2); }
-  .funding a {
-    display: block;
-    color: black; }
-
-.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 #DDDDDD; }
-  .wlfund .funding-plus td div {
-    background: rgba(13, 126, 133, 0.2); }
-  .wlfund .funding-minus td div {
-    bbackground: rgba(255, 0, 0, 0.2);
-    background: white; }
+a.funding{font-size:1.5em;padding:.5em 1em;display:block;color:#000;background-image:url(/static/img/green-pixel.png);background-repeat:repeat-y;background-color:rgba(13, 126, 133, .2)}.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{bbackground:rgba(255, 0, 0, .2);background:#fff}.funding-current{margin-bottom:3em}.funding-stale .funding{opacity:.5}
\ No newline at end of file
index 8de3ef8..c5e8c48 100755 (executable)
@@ -1,15 +1,12 @@
-.funding {
+a.funding {
     font-size: 1.5em;
     font-size: 1.5em;
-    padding: 0;
     padding: .5em 1em;
     padding: .5em 1em;
+    display: block;
+    color: black;
+
     background-image: url(/static/img/green-pixel.png);
     background-repeat: repeat-y;
     background-color: fade-out(#0D7E85, .8);
     background-image: url(/static/img/green-pixel.png);
     background-repeat: repeat-y;
     background-color: fade-out(#0D7E85, .8);
-
-    a {
-        display: block;
-        color: black;
-    }
 }
 
 .wlfund {
 }
 
 .wlfund {
         background: white;
     }
 }
         background: white;
     }
 }
+
+
+.funding-current {
+    margin-bottom: 3em;
+}
+.funding-stale {
+    .funding {
+        opacity: .5;
+    }
+}
index 3f49b88..53c514f 100755 (executable)
@@ -1,50 +1,65 @@
 {% extends "base.html" %}
 {% load url from future %}
 {% extends "base.html" %}
 {% load url from future %}
+{% load i18n %}
 {% load funding_tags %}
 {% load funding_tags %}
-{% load uni_form_tags %}
+
 
 {% block titleextra %}{{ object }}{% endblock %}
 
 
 {% block titleextra %}{{ object }}{% endblock %}
 
+
 {% block body %}
 
 <h1>{{ object }}</h1>
 {% block body %}
 
 <h1>{{ object }}</h1>
-<div class="white-box normal-text">
+<div class="white-box">
 
 
-{% funding object %}
+    {% funding object %}
+    {% offer_detail_head object %}
 
 
-{% if object.state == 'running' %}
+    {% if object.state == 'running' %}
 
 
+        <div class="normal-text">
+
+            <h3>{% trans "Support" %}</h3>
+            <form action="" method="post">
+                {% csrf_token %}
+                <table>
+                {{ form.as_table }}
+                <tr><td></td><td><button type="submit">Wpłać!</button></td></tr>
+                </table>
+            </form>
+
+        </div>
+    {% endif %}
+
+    <p class="normal-text"><a href="{% url 'funding' %}">Zobacz wszystkie zbiórki.</a></p>
 
 
-<h3>Wpłać:</h3>
-<form action="" method="post">
-    {% csrf_token %}
-    {{ form|as_uni_form }}
-<!--
-    {% for perk in object.get_perks %}
-        <br/><label><input type="radio" name="amount" value="{{ perk.price }}" /> {{perk.price}} zł: {{perk.name}}</label>
-    {% endfor %}
-    <br/><label><input type="radio" name="amount" value="" /> Dowolną kwotę:</label>
-        <input name="amount" size="5" /> zł
-    </label>
--->
-    <br/><button type="submit">Wpłać!</button>
-</form>
-{% endif %}
-
-<p><a href="{% url 'funding' %}">Zobacz wszystkie zbiórki.</a></p>
 </div>
 
 
 </div>
 
 
-<h2 style="font-size: 3em; margin: 1em 0 .5em;">Wpłaty:</h2>
+<h2 style="font-size: 3em; margin: 1em 0 .5em;">{% trans "Supporters" %}:</h2>
 
 <div class="white-box normal-text">
     
 
 <div class="white-box normal-text">
     
+    <table class="wlfund">
+    {% for funding in object.funding_set.all %}
+        <tr class="funding-plus">
+            <td><div>{{ funding.payed_at.date }}</div></td>
+            <td><div>
+                {% if funding.anonymous %}
+                    <em>{% trans "Anonymous" %}</em>
+                {% else %}
+                    {{ funding.name }}
+                {% 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>
 
 
-<ul>
-{% for funding in object.funding_set.all %}
-    <li>{{ funding.name }}: <strong>{{ funding.amount }} zł</strong></li>
-{% endfor %}
-</ul>
 </div>
 
 {% endblock %}
 </div>
 
 {% endblock %}
index 6114e37..44cd828 100755 (executable)
@@ -1,27 +1,23 @@
 {% extends "base.html" %}
 {% load url from future %}
 {% extends "base.html" %}
 {% load url from future %}
+{% load i18n %}
 {% load funding_tags %}
 
 {% load funding_tags %}
 
-{% block titleextra %}Funding{% endblock %}
+{% block titleextra %}{% trans "Support Wolne Lektury" %}{% endblock %}
 
 {% block body %}
 
 {% block body %}
-<h1>Funding!</h1>
+<h1>{% trans "Support Wolne Lektury" %}</h1>
 
 <ul class="plain">
 {% for funding in object_list %}
 
 <ul class="plain">
 {% for funding in object_list %}
-    <li class="white-box normal-text" style="margin-bottom:1em;">
-        <p>{{ funding.start }} – {{ funding.end }}</p>
-        {% funding funding link=1 add_class="standalone-funding" %}
-        {% if funding.state == "win" %}
-            {% if funding.book_url %}
-                <p><a href="{{ funding.book_url }}">Zobacz opublikowaną książkę</a></p>
-            {% else %}
-                <p>Termin publikacji: {{ funding.term }}</p>
-            {% endif %}
-        {% elif funding.state == "lose" %}
-            <p>Cel finansowania nie został osiągnięty. Zgromadzone środki
-            zostały przekazane na <a href="{% url 'funding_wlfund' %}">Fundusz Wolnych Lektur</a>.</p>
+    <li class="white-box funding-{% if funding.is_current %}current{% else %}stale{% endif %}">
+        <p class="normal-text">{{ funding.start }} – {{ funding.end }}
+        {% if not funding.is_current %}
+            ({% trans "funding closed" %})
         {% endif %}
         {% endif %}
+        </p>
+        {% funding funding link=1 %}
+        {% offer_detail_head funding %}
     </li>
 {% endfor %}
 </ul>
     </li>
 {% endfor %}
 </ul>
index 7d72c31..981ae62 100755 (executable)
@@ -1,11 +1,23 @@
+{% load i18n %}
 {% load time_tags %}
 {% load time_tags %}
-<div
+{% if offer %}
+<a
     class="funding {{ add_class }}"
     class="funding {{ add_class }}"
-    style="background-size: {{ percentage|stringformat:'.2f' }}% 1px;">
-    {% if link %}<a href="{{ offer.get_absolute_url }}">{% endif %}
-    {{ offer }};
-    zebraliśmy {{ offer.sum }} z {{ offer.target }}{% if offer.state = 'running' %};
-    do końca: <strong class="countdown inline" data-until='{{ offer.end|local_to_utc|utc_for_js }}'></strong>
+    style="background-size: {{ percentage|stringformat:'.2f' }}% 1px;"
+    {% if link %}href="{{ offer.get_absolute_url }}"{% endif %}
+    >
+    {% if is_current %}
+        {% trans "Support a book:" %}
     {% endif %}
     {% endif %}
-    {% if link %}</a>{% endif %}
-</div>
+    <em>{{ offer }}</em>
+    <span style="float:right">
+    {% trans "collected" %}: <em>{{ offer.sum }} / {{ offer.target }} zł</em>
+    {% if is_current %}
+        <span style="margin-left: 2em;">{% trans "until fundraiser end" %}:
+            <strong class="countdown inline" data-until='{{ offer.end|local_to_utc|utc_for_js }}'></strong>
+        </span>
+    {% endif %}
+    </span>
+    <div style="clear:both"></div>
+</a>
+{% endif %}
diff --git a/apps/funding/templates/funding/tags/offer_detail_head.html b/apps/funding/templates/funding/tags/offer_detail_head.html
new file mode 100644 (file)
index 0000000..000b9b8
--- /dev/null
@@ -0,0 +1,35 @@
+{% load url from future %}
+{% load i18n %}
+{% if state == "running" %}
+    <p class="normal-text">
+        {% blocktrans with due=offer.due end=offer.end %}If the target is met
+        by {{ end }}, this book will be published by {{ due }}.{% endblocktrans %}
+    </p>
+    <p class="normal-text">
+        {% url 'funding_wlfund' as url %}
+        {% blocktrans %}Any excessive money will be transfered to the
+        <a href="{{ url }}">Wolne Lektury Fund</a>.{% endblocktrans %}
+    </p>
+{% elif state == "win" %}
+    {% if offer.book %}
+        <p class="normal-text">{% trans "See the published book:" %}
+            <a href="{{ offer.book.get_absolute_url }}">{{ offer.book }}</a>.</p>
+    {% else %}
+            <p class="normal-text">{% trans "Funding target has been met!" %}</p>
+        <p class="normal-text">{% trans "The book will be published by:" %} {{ offer.due }}.
+        {% if offer.redakcja_url %}
+            {% with url=offer.redakcja_url %}
+            {% blocktrans %}You can follow the work on the <a href="{{ url }}">Editorial Platform</a>.{% endblocktrans %}
+            {% endwith %}
+        {% endif %}
+        </p>
+    {% endif %}
+{% elif state == "lose" %}
+    <p class="normal-text">{% trans "Funding target has not been met." %}
+    {% if offer.sum %}
+        {% url 'funding_wlfund' as url %}
+        {% blocktrans %}Collected funds have been transfered to the
+        <a href="{{ url }}">Wolne Lektury Fund</a>.{% endblocktrans %}
+    {% endif %}
+    </p>
+{% endif %}
index baf2275..2863c69 100755 (executable)
@@ -1,16 +1,17 @@
 {% extends "base.html" %}
 {% extends "base.html" %}
+{% load i18n %}
 {% load funding_tags %}
 
 {% load funding_tags %}
 
-{% block titleextra %}Dziękujemy!{% endblock %}
+{% block titleextra %}{% trans "Thank you!" %}{% endblock %}
 
 {% block body %}
 
 
 {% block body %}
 
-<h1>Dziękujemy!</h1>
+<h1>{% trans "Thank you!" %}</h1>
 <div class="white-box normal-text">
 
 <div class="white-box normal-text">
 
-Dziękujemy za wsparcie!
+{% trans "Thank you for your support!" %}
 
 
-<p><a href="{{ object.get_absolute_url }}">Wróć do strony aktualnej zbiórki.</a></p>
+<p><a href="{{ object.get_absolute_url }}">{% trans "Go back to the current fundraiser." %}</a></p>
 </div>
 
 
 </div>
 
 
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..edb7a51
--- /dev/null
@@ -0,0 +1,17 @@
+{% load i18n %}
+{% if perks %}
+    {% for perk in perks %}
+        <label>
+            <input type="radio" name="{{ perks_input_name }}" value="{{ perk.price }}"
+                    {% if perk.chosen %}checked="checked"{% endif %} />
+                {{ perk.price }} zł ({{ 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 %}
index 5f3ca65..8188f1a 100755 (executable)
@@ -1,33 +1,37 @@
 {% extends "base.html" %}
 {% extends "base.html" %}
+{% load i18n %}
 
 
-{% block titleextra %}Fundusz Wolnych Lektur{% endblock %}
+{% block titleextra %}{% trans "Wolne Lektury Fund" %}{% endblock %}
 
 {% block body %}
 
 
 {% block body %}
 
-<h1>Fundusz Wolnych Lektur</h1>
+<h1>{% trans "Wolne Lektury Fund" %}</h1>
 
 
 <table class="normal-text wlfund">
 
 
 
 <table class="normal-text wlfund">
 
-    <tr class=""><td><div>Bilans:</div></td><td><div>{{ amount }}</div></td><td colspan="2"><div>&nbsp;</div></td></tr>
-
-
+    <tr>
+        <td><div>{% trans "Balance" %}:</div></td>
+        <td><div>&nbsp;</div></td>
+        <td><div>{{ amount }} zł</div></td>
+        <td><div>&nbsp;</div></td>
+    </tr>
 
     {% for tag, entry in log %}
     {% if tag == 'spent' %}
         <tr class="funding-minus">
             <td><div>{{ entry.timestamp }}</div></td>
 
     {% for tag, entry in log %}
     {% if tag == 'spent' %}
         <tr class="funding-minus">
             <td><div>{{ entry.timestamp }}</div></td>
-            <td><div>{{ entry.total }}</div></td>
-            <td><div>-{{ entry.amount }}&nbsp;zł</div></td>
-            <td><div>Książka: <a href="{{ entry.book.get_absolute_url }}">
+            <td><div>-{{ entry.amount }} zł</div></td>
+            <td><div>{{ entry.total }} zł</div></td>
+            <td><div>{% trans "Book" %}: <a href="{{ entry.book.get_absolute_url }}">
                 {{ entry.book }}</a></div></td>
         </tr>
     {% else %}
         <tr class="funding-plus">
             <td><div>{{ entry.end }}</div></td>
                 {{ entry.book }}</a></div></td>
         </tr>
     {% else %}
         <tr class="funding-plus">
             <td><div>{{ entry.end }}</div></td>
-            <td><div>{{ entry.total }}</div></td>
-            <td><div>+{{ entry.sum }}&nbsp;zł</div></td>
-            <td><div>Pieniądze z częściowej zbiórki: 
+            <td><div>+{{ entry.sum }} zł</div></td>
+            <td><div>{{ entry.total }} zł</div></td>
+            <td><div>{% trans "Money from partial fundraiser" %}:
                 <a href="{{ entry.get_absolute_url }}">
                 {{ entry }}</a></div></td>
         </tr>
                 <a href="{{ entry.get_absolute_url }}">
                 {{ entry }}</a></div></td>
         </tr>
index c533672..5331f8c 100755 (executable)
@@ -8,10 +8,22 @@ register = template.Library()
 def funding(offer=None, link=False, add_class=""):
     if offer is None:
         offer = Offer.current()
 def funding(offer=None, link=False, add_class=""):
     if offer is None:
         offer = Offer.current()
+    if offer is None:
+        return {}
 
     return {
         'offer': offer,
 
     return {
         'offer': offer,
+        'is_current': offer.is_current(),
         'percentage': 100 * offer.sum() / offer.target,
         'link': link,
         'add_class': add_class,
     }
         'percentage': 100 * offer.sum() / offer.target,
         'link': link,
         'add_class': add_class,
     }
+
+
+@register.inclusion_tag("funding/tags/offer_detail_head.html")
+def offer_detail_head(offer):
+    return {
+        'offer': offer,
+        'state': offer.state(),
+    }
+    
index 05bf398..f543162 100644 (file)
@@ -1,4 +1,8 @@
-# Create your views here.
+# -*- 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 import settings
 from django.core.urlresolvers import reverse
 from django.shortcuts import redirect, get_object_or_404
 from django.views.generic import TemplateView, FormView, DetailView
 from django.core.urlresolvers import reverse
 from django.shortcuts import redirect, get_object_or_404
 from django.views.generic import TemplateView, FormView, DetailView
@@ -65,7 +69,7 @@ class OfferDetailView(FormView):
         if self.request.method == 'POST':
             return form_class(self.object, self.request.POST)
         else:
         if self.request.method == 'POST':
             return form_class(self.object, self.request.POST)
         else:
-            return form_class(self.object)
+            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)
 
     def get_context_data(self, *args, **kwargs):
         ctx = super(OfferDetailView, self).get_context_data(*args, **kwargs)
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(',', '.')
+            
+    
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;
+    }
+}
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 645015c..300b22e 100644 (file)
@@ -7,7 +7,7 @@ South>=0.7 # migrations for django
 django-pipeline>=1.2.24,<1.3
 django-pagination>=1.0
 django-maintenancemode>=0.10
 django-pipeline>=1.2.24,<1.3
 django-pagination>=1.0
 django-maintenancemode>=0.10
-django-piston==0.2.2
+django-piston>=0.2.2,<0.2.3
 #django-jsonfield
 -e git+git://github.com/bradjasper/django-jsonfield.git@2f427368ad70bf8d9a0580df58ec0eb0654d62ae#egg=django-jsonfield
 django-picklefield
 #django-jsonfield
 -e git+git://github.com/bradjasper/django-jsonfield.git@2f427368ad70bf8d9a0580df58ec0eb0654d62ae#egg=django-jsonfield
 django-picklefield
@@ -15,6 +15,7 @@ django-picklefield
 # version of django-allauth 0.4 with install script fixed
 -e git+git://github.com/pennersr/django-allauth.git@3a03db9b2ecca370af228df367bd8fa52afea5ea#egg=django-allauth
 pytz
 # version of django-allauth 0.4 with install script fixed
 -e git+git://github.com/pennersr/django-allauth.git@3a03db9b2ecca370af228df367bd8fa52afea5ea#egg=django-allauth
 pytz
+pyScss
 
 django-honeypot
 django-uni-form
 
 django-honeypot
 django-uni-form
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
 # set to 'new' or 'old' to skip time-consuming test
 # for TeX morefloats library version
 LIBRARIAN_PDF_MOREFLOATS = None
+
+FUNDING_DEFAULT = 20
index 8d0e5be..83de0da 100644 (file)
@@ -31,6 +31,7 @@ PIPELINE_CSS = {
             'sponsors/css/sponsors.css',
             'css/auth.css',
             'funding/funding.scss',
             'sponsors/css/sponsors.css',
             'css/auth.css',
             'funding/funding.scss',
+            'css/form.scss',
 
             'css/social/shelf_tags.css',
             'css/ui-lightness/jquery-ui-1.8.16.custom.css',
 
             'css/social/shelf_tags.css',
             'css/ui-lightness/jquery-ui-1.8.16.custom.css',
@@ -123,5 +124,7 @@ PIPELINE_CSS_COMPRESSOR = None
 PIPELINE_JS_COMPRESSOR = None
 
 PIPELINE_COMPILERS = (
 PIPELINE_JS_COMPRESSOR = None
 
 PIPELINE_COMPILERS = (
-    'pipeline.compilers.sass.SASSCompiler',
+    'pyscss_compiler.PySCSSCompiler',
 )
 )
+PIPELINE_PYSCSS_BINARY = '/usr/bin/env pyscss'
+PIPELINE_PYSCSS_ARGUMENTS = ''