From: Radek Czajka Date: Thu, 24 Dec 2015 12:23:01 +0000 (+0100) Subject: Django 1.8 and other updates. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/6280673f35e13e75e81c5b7821bd2a44a1831eab?ds=sidebyside;hp=013ec8a416d4ff1ea3e1f2fa9ee2935623197ecd Django 1.8 and other updates. --- diff --git a/.hgignore b/.hgignore deleted file mode 100644 index 3ea3b462c..000000000 --- a/.hgignore +++ /dev/null @@ -1,8 +0,0 @@ -syntax: glob - -local_settings.py -lektury.sqlite -wolnelektury/media/lektura/* -*.pyc -*.DS_Store -localsettings.py \ No newline at end of file diff --git a/.hgtags b/.hgtags deleted file mode 100644 index 0edbce637..000000000 --- a/.hgtags +++ /dev/null @@ -1 +0,0 @@ -fa4bcbf759901d7444c98e3f0a3a9aa7da1b8a1b wolnelektury-1.0 diff --git a/apps/api/migrations/0002_auto_20151221_1225.py b/apps/api/migrations/0002_auto_20151221_1225.py new file mode 100644 index 000000000..339068ac5 --- /dev/null +++ b/apps/api/migrations/0002_auto_20151221_1225.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='deleted', + name='slug', + field=models.SlugField(max_length=120, verbose_name='slug', blank=True), + ), + ] diff --git a/apps/catalogue/migrations/0008_auto_20151221_1225.py b/apps/catalogue/migrations/0008_auto_20151221_1225.py new file mode 100644 index 000000000..ba6c47027 --- /dev/null +++ b/apps/catalogue/migrations/0008_auto_20151221_1225.py @@ -0,0 +1,255 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import jsonfield.fields +import catalogue.fields +import catalogue.models.bookmedia + + +class Migration(migrations.Migration): + + dependencies = [ + ('catalogue', '0007_auto_20151123_1529'), + ] + + operations = [ + migrations.AlterModelOptions( + name='book', + options={'ordering': ('sort_key',), 'verbose_name': 'book', 'verbose_name_plural': 'books'}, + ), + migrations.AlterModelOptions( + name='fragment', + options={'ordering': ('book', 'anchor'), 'verbose_name': 'fragment', 'verbose_name_plural': 'fragments'}, + ), + migrations.AlterField( + model_name='book', + name='ancestor', + field=models.ManyToManyField(related_name='descendant', editable=False, to='catalogue.Book', blank=True), + ), + migrations.AlterField( + model_name='book', + name='common_slug', + field=models.SlugField(max_length=120, verbose_name='slug'), + ), + migrations.AlterField( + model_name='book', + name='description', + field=models.TextField(verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='book', + name='extra_info', + field=jsonfield.fields.JSONField(default={}, verbose_name='extra information'), + ), + migrations.AlterField( + model_name='book', + name='parent_number', + field=models.IntegerField(default=0, verbose_name='parent number'), + ), + migrations.AlterField( + model_name='book', + name='slug', + field=models.SlugField(unique=True, max_length=120, verbose_name='slug'), + ), + migrations.AlterField( + model_name='book', + name='sort_key', + field=models.CharField(verbose_name='sort key', max_length=120, editable=False, db_index=True), + ), + migrations.AlterField( + model_name='book', + name='title', + field=models.CharField(max_length=32767, verbose_name='title'), + ), + migrations.AlterField( + model_name='bookmedia', + name='extra_info', + field=jsonfield.fields.JSONField(default={}, verbose_name='extra information', editable=False), + ), + migrations.AlterField( + model_name='bookmedia', + name='file', + field=catalogue.fields.OverwritingFileField(upload_to=catalogue.models.bookmedia._file_upload_to, max_length=600, verbose_name='file'), + ), + migrations.AlterField( + model_name='collection', + name='book_slugs', + field=models.TextField(verbose_name='book slugs'), + ), + migrations.AlterField( + model_name='collection', + name='description', + field=models.TextField(null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='collection', + name='description_de', + field=models.TextField(null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='collection', + name='description_en', + field=models.TextField(null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='collection', + name='description_es', + field=models.TextField(null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='collection', + name='description_fr', + field=models.TextField(null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='collection', + name='description_it', + field=models.TextField(null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='collection', + name='description_lt', + field=models.TextField(null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='collection', + name='description_pl', + field=models.TextField(null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='collection', + name='description_ru', + field=models.TextField(null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='collection', + name='description_uk', + field=models.TextField(null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='collection', + name='kind', + field=models.CharField(default=b'book', max_length=10, verbose_name='kind', db_index=True, choices=[(b'book', 'book'), (b'picture', b'picture')]), + ), + migrations.AlterField( + model_name='collection', + name='slug', + field=models.SlugField(max_length=120, serialize=False, verbose_name='slug', primary_key=True), + ), + migrations.AlterField( + model_name='collection', + name='title', + field=models.CharField(max_length=120, verbose_name='title', db_index=True), + ), + migrations.AlterField( + model_name='collection', + name='title_de', + field=models.CharField(max_length=120, null=True, verbose_name='title', db_index=True), + ), + migrations.AlterField( + model_name='collection', + name='title_en', + field=models.CharField(max_length=120, null=True, verbose_name='title', db_index=True), + ), + migrations.AlterField( + model_name='collection', + name='title_es', + field=models.CharField(max_length=120, null=True, verbose_name='title', db_index=True), + ), + migrations.AlterField( + model_name='collection', + name='title_fr', + field=models.CharField(max_length=120, null=True, verbose_name='title', db_index=True), + ), + migrations.AlterField( + model_name='collection', + name='title_it', + field=models.CharField(max_length=120, null=True, verbose_name='title', db_index=True), + ), + migrations.AlterField( + model_name='collection', + name='title_lt', + field=models.CharField(max_length=120, null=True, verbose_name='title', db_index=True), + ), + migrations.AlterField( + model_name='collection', + name='title_pl', + field=models.CharField(max_length=120, null=True, verbose_name='title', db_index=True), + ), + migrations.AlterField( + model_name='collection', + name='title_ru', + field=models.CharField(max_length=120, null=True, verbose_name='title', db_index=True), + ), + migrations.AlterField( + model_name='collection', + name='title_uk', + field=models.CharField(max_length=120, null=True, verbose_name='title', db_index=True), + ), + migrations.AlterField( + model_name='tag', + name='category', + field=models.CharField(db_index=True, max_length=50, verbose_name='category', choices=[(b'author', 'author'), (b'epoch', 'epoch'), (b'kind', 'kind'), (b'genre', 'genre'), (b'theme', 'theme'), (b'set', 'set'), (b'thing', 'thing')]), + ), + migrations.AlterField( + model_name='tag', + name='description', + field=models.TextField(verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='tag', + name='description_de', + field=models.TextField(null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='tag', + name='description_en', + field=models.TextField(null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='tag', + name='description_es', + field=models.TextField(null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='tag', + name='description_fr', + field=models.TextField(null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='tag', + name='description_it', + field=models.TextField(null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='tag', + name='description_lt', + field=models.TextField(null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='tag', + name='description_pl', + field=models.TextField(null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='tag', + name='description_ru', + field=models.TextField(null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='tag', + name='description_uk', + field=models.TextField(null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='tag', + name='slug', + field=models.SlugField(max_length=120, verbose_name='slug'), + ), + migrations.AlterField( + model_name='tag', + name='sort_key', + field=models.CharField(max_length=120, verbose_name='sort key', db_index=True), + ), + ] diff --git a/apps/catalogue/models/book.py b/apps/catalogue/models/book.py index bfc9ec4f5..5f68e09ff 100644 --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.py @@ -71,7 +71,7 @@ class Book(models.Model): parent = models.ForeignKey('self', blank=True, null=True, related_name='children') - ancestor = models.ManyToManyField('self', blank=True, null=True, + ancestor = models.ManyToManyField('self', blank=True, editable=False, related_name='descendant', symmetrical=False) objects = models.Manager() diff --git a/apps/catalogue/templates/catalogue/player.html b/apps/catalogue/templates/catalogue/player.html index 507e5d51a..701fbe850 100755 --- a/apps/catalogue/templates/catalogue/player.html +++ b/apps/catalogue/templates/catalogue/player.html @@ -1,7 +1,7 @@ {% load static from staticfiles %} - {% load i18n compressed %} + {% load i18n pipeline %} {% load catalogue_tags %} {% load thumbnail %} @@ -11,8 +11,8 @@ {% trans "Wolne Lektury" %} :: {{ book.title }} - {{ audiobook }} - {% compressed_css "all" %} - {% compressed_css "player" %} + {% stylesheet "all" %} + {% stylesheet "player" %} @@ -133,7 +133,7 @@ - {% compressed_js "player" %} + {% javascript "player" %} {{ piwik_tag|safe }} diff --git a/apps/catalogue/templates/catalogue/viewer_base.html b/apps/catalogue/templates/catalogue/viewer_base.html index 1b4a92b22..416b9defe 100644 --- a/apps/catalogue/templates/catalogue/viewer_base.html +++ b/apps/catalogue/templates/catalogue/viewer_base.html @@ -1,14 +1,14 @@ {% load i18n %} {% load static from staticfiles %} -{% load compressed %} +{% load pipeline %} {% block title %}{% endblock %} :: {% trans "Wolne Lektury" %} - {% compressed_css "book_text" %} + {% stylesheet "book_text" %} {% block extrahead %}{% endblock %} @@ -65,7 +65,7 @@ var LANGUAGE_CODE = "{{ LANGUAGE_CODE }}"; var STATIC_URL = "{{ STATIC_URL }}"; - {% compressed_js "book_text" %} + {% javascript "book_text" %} {{ piwik_tag|safe }} {% block extrabody %}{% endblock %} diff --git a/apps/catalogue/test_utils.py b/apps/catalogue/test_utils.py index 101a508b8..9d87311dd 100644 --- a/apps/catalogue/test_utils.py +++ b/apps/catalogue/test_utils.py @@ -21,6 +21,7 @@ from django.conf import settings 'default': {'BACKEND': 'django.core.cache.backends.dummy.DummyCache'}, }, SOLR=settings.SOLR_TEST, + SSIFY_RENDER=False, ) class WLTestCase(TestCase): """ diff --git a/apps/catalogue/tests/__init__.py b/apps/catalogue/tests/__init__.py index 79aed52a7..9c41af207 100644 --- a/apps/catalogue/tests/__init__.py +++ b/apps/catalogue/tests/__init__.py @@ -8,4 +8,4 @@ from catalogue.tests.cover import * from catalogue.tests.search import * from catalogue.tests.tags import * from catalogue.tests.templatetags import * -from .test_visit import * +from .visit import * diff --git a/apps/catalogue/tests/test_visit.py b/apps/catalogue/tests/test_visit.py deleted file mode 100644 index 1bdbdbd74..000000000 --- a/apps/catalogue/tests/test_visit.py +++ /dev/null @@ -1,79 +0,0 @@ -# -*- 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 catalogue import models -from catalogue.test_utils import BookInfoStub, PersonStub, WLTestCase, info_args -from django.core.files.base import ContentFile - - -class VisitTest(WLTestCase): - """Simply create some objects and visit some views.""" - - def setUp(self): - WLTestCase.setUp(self) - author = PersonStub(("Jane",), "Doe") - book_info = BookInfoStub(author=author, genre="Genre", - epoch='Epoch', kind="Kind", **info_args(u"A book")) - self.book = models.Book.from_text_and_meta(ContentFile(''' - - - - - Theme - Test - - - - - '''), book_info) - self.collection = models.Collection.objects.create( - title='Biblioteczka Boya', slug='boy', book_slugs='a-book') - - def test_visit_urls(self): - """ book description should return authors, ancestors, book """ - url_map = { - 200: [ - '', - 'lektury/', - 'lektury/boy/', - 'nowe/', - 'lektura/a-book/', - 'lektura/a-book.html', - 'lektura/a-book/motyw/theme/', - 'motyw/theme/', - 'autor/jane-doe/', - 'autor/jane-doe/gatunek/genre/', - 'autor/jane-doe/gatunek/genre/motyw/theme/', - 'pl.json', - 'b/%d/mini.pl.html' % self.book.pk, - 'b/%d/mini_nolink.pl.html' % self.book.pk, - 'b/%d/short.pl.html' % self.book.pk, - 'b/%d/wide.pl.html' % self.book.pk, - 'f/%d/promo.pl.html' % self.book.fragments.all()[0].pk, - 'f/%d/short.pl.html' % self.book.fragments.all()[0].pk, - ], - 404: [ - 'lektury/nonexistent/', # Nonexistent Collection. - 'lektura/nonexistent/', # Nonexistent Book. - 'lektura/nonexistent.html', # Nonexistent Book's HTML. - 'lektura/nonexistent/motyw/theme/', # Nonexistent Book's theme. - 'lektura/a-book/motyw/nonexistent/', # Nonexistent theme in a Book. - 'autor/nonexistent/', # Nonexistent author. - 'motyw/nonexistent/', # Nonexistent theme. - 'zh.json', # Nonexistent language. - 'b/%d/mini.pl.html' % (self.book.pk + 100), # Nonexistent book. - 'b/%d/mini_nolink.pl.html' % (self.book.pk + 100), # Nonexistent book. - 'b/%d/short.pl.html' % (self.book.pk + 100), # Nonexistent book. - 'b/%d/wide.pl.html' % (self.book.pk + 100), # Nonexistent book. - 'f/%d/promo.pl.html' % (self.book.fragments.all()[0].pk + 100), # Nonexistent fragment. - 'f/%d/short.pl.html' % (self.book.fragments.all()[0].pk + 100), # Nonexistent fragment. - ] - } - prefix = '/katalog/' - for expected_status, urls in url_map.items(): - for url in urls: - status = self.client.get(prefix + url).status_code - self.assertEqual(status, expected_status, - "Wrong status code for '%s'. Expected %d, got %d." % ( - prefix + url, expected_status, status)) diff --git a/apps/catalogue/tests/visit.py b/apps/catalogue/tests/visit.py new file mode 100644 index 000000000..cab3c987d --- /dev/null +++ b/apps/catalogue/tests/visit.py @@ -0,0 +1,80 @@ +# -*- 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 catalogue import models +from catalogue.test_utils import BookInfoStub, PersonStub, WLTestCase, info_args +from django.core.files.base import ContentFile + + +class VisitTest(WLTestCase): + """Simply create some objects and visit some views.""" + + def setUp(self): + WLTestCase.setUp(self) + author = PersonStub(("Jane",), "Doe") + book_info = BookInfoStub(author=author, genre="Genre", + epoch='Epoch', kind="Kind", **info_args(u"A book")) + self.book = models.Book.from_text_and_meta(ContentFile(''' + + + + + Theme + Test + + + + + '''), book_info) + self.collection = models.Collection.objects.create( + title='Biblioteczka Boya', slug='boy', book_slugs='a-book') + + def test_visit_urls(self): + """ book description should return authors, ancestors, book """ + url_map = { + 200: [ + '', + 'lektury/', + 'lektury/boy/', + 'nowe/', + 'lektura/a-book/', + 'lektura/a-book.html', + 'lektura/a-book/motyw/theme/', + 'motyw/theme/', + 'autor/jane-doe/', + 'autor/jane-doe/gatunek/genre/', + 'autor/jane-doe/gatunek/genre/motyw/theme/', + 'pl.json', + 'b/%d/mini.pl.html' % self.book.pk, + 'b/%d/mini_nolink.pl.html' % self.book.pk, + 'b/%d/short.pl.html' % self.book.pk, + 'b/%d/wide.pl.html' % self.book.pk, + 'f/%d/promo.pl.html' % self.book.fragments.all()[0].pk, + 'f/%d/short.pl.html' % self.book.fragments.all()[0].pk, + ], + 404: [ + 'lektury/nonexistent/', # Nonexistent Collection. + 'lektura/nonexistent/', # Nonexistent Book. + 'lektura/nonexistent.html', # Nonexistent Book's HTML. + 'lektura/nonexistent/motyw/theme/', # Nonexistent Book's theme. + 'lektura/a-book/motyw/nonexistent/', # Nonexistent theme in a Book. + 'autor/nonexistent/', # Nonexistent author. + 'motyw/nonexistent/', # Nonexistent theme. + 'zh.json', # Nonexistent language. + 'b/%d/mini.pl.html' % (self.book.pk + 100), # Nonexistent book. + 'b/%d/mini_nolink.pl.html' % (self.book.pk + 100), # Nonexistent book. + 'b/%d/short.pl.html' % (self.book.pk + 100), # Nonexistent book. + 'b/%d/wide.pl.html' % (self.book.pk + 100), # Nonexistent book. + 'f/%d/promo.pl.html' % (self.book.fragments.all()[0].pk + 100), # Nonexistent fragment. + 'f/%d/short.pl.html' % (self.book.fragments.all()[0].pk + 100), # Nonexistent fragment. + ] + } + prefix = '/katalog/' + for expected_status, urls in url_map.items(): + for url in urls: + print(url) + status = self.client.get(prefix + url).status_code + self.assertEqual(status, expected_status, + "Wrong status code for '%s'. Expected %d, got %d." % ( + prefix + url, expected_status, status)) diff --git a/apps/catalogue/urls.py b/apps/catalogue/urls.py index 6e98fb094..b7c59a055 100644 --- a/apps/catalogue/urls.py +++ b/apps/catalogue/urls.py @@ -26,7 +26,7 @@ urlpatterns = patterns('picture.views', urlpatterns += patterns('', # old search page - redirected url(r'^szukaj/$', RedirectView.as_view( - url='/szukaj/', query_string=True)), + url='/szukaj/', query_string=True, permanent=True)), ) urlpatterns += patterns('catalogue.views', diff --git a/apps/chunks/migrations/0003_auto_20151221_1225.py b/apps/chunks/migrations/0003_auto_20151221_1225.py new file mode 100644 index 000000000..a7d7ca33b --- /dev/null +++ b/apps/chunks/migrations/0003_auto_20151221_1225.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('chunks', '0002_auto_20140911_1253'), + ] + + operations = [ + migrations.AlterModelOptions( + name='chunk', + options={'ordering': ('key',), 'verbose_name': 'chunk', 'verbose_name_plural': 'chunks'}, + ), + migrations.AlterField( + model_name='chunk', + name='description', + field=models.CharField(max_length=255, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='chunk', + name='key', + field=models.CharField(help_text='A unique name for this chunk of content', max_length=255, serialize=False, verbose_name='key', primary_key=True), + ), + ] diff --git a/apps/dictionary/migrations/0004_auto_20151221_1225.py b/apps/dictionary/migrations/0004_auto_20151221_1225.py new file mode 100644 index 000000000..ee7252ce0 --- /dev/null +++ b/apps/dictionary/migrations/0004_auto_20151221_1225.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('dictionary', '0003_auto_20141023_1445'), + ] + + operations = [ + migrations.AlterField( + model_name='note', + name='qualifiers', + field=models.ManyToManyField(to='dictionary.Qualifier'), + ), + ] diff --git a/apps/dictionary/models.py b/apps/dictionary/models.py index d0d8b69ac..cc2b0ac51 100644 --- a/apps/dictionary/models.py +++ b/apps/dictionary/models.py @@ -28,7 +28,7 @@ class Note(models.Model): html = models.TextField() sort_key = models.CharField(max_length=128, db_index=True) fn_type = models.CharField(max_length=10, db_index=True) - qualifiers = models.ManyToManyField(Qualifier, null=True) + qualifiers = models.ManyToManyField(Qualifier) language = models.CharField(max_length=10, db_index=True) class Meta: diff --git a/apps/dictionary/views.py b/apps/dictionary/views.py index 40b36baf4..69c6bf65c 100755 --- a/apps/dictionary/views.py +++ b/apps/dictionary/views.py @@ -12,7 +12,7 @@ from .models import Note, Qualifier class NotesView(ListView): def get_queryset(self): - objects = Note.objects.select_related('book').all() + objects = Note.objects.all() filters = {} try: diff --git a/apps/funding/migrations/0002_auto_20151221_1225.py b/apps/funding/migrations/0002_auto_20151221_1225.py new file mode 100644 index 000000000..3224eb006 --- /dev/null +++ b/apps/funding/migrations/0002_auto_20151221_1225.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('funding', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='funding', + name='email', + field=models.EmailField(db_index=True, max_length=254, verbose_name='email', blank=True), + ), + migrations.AlterField( + model_name='offer', + name='description', + field=models.TextField(verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='offer', + name='slug', + field=models.SlugField(verbose_name='slug'), + ), + migrations.AlterField( + model_name='offer', + name='title', + field=models.CharField(max_length=255, verbose_name='title'), + ), + ] diff --git a/apps/infopages/migrations/0002_auto_20151221_1225.py b/apps/infopages/migrations/0002_auto_20151221_1225.py new file mode 100644 index 000000000..d5755e7ef --- /dev/null +++ b/apps/infopages/migrations/0002_auto_20151221_1225.py @@ -0,0 +1,69 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('infopages', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='infopage', + name='slug', + field=models.SlugField(unique=True, max_length=120, verbose_name='slug'), + ), + migrations.AlterField( + model_name='infopage', + name='title', + field=models.CharField(max_length=120, verbose_name='title', blank=True), + ), + migrations.AlterField( + model_name='infopage', + name='title_de', + field=models.CharField(max_length=120, null=True, verbose_name='title', blank=True), + ), + migrations.AlterField( + model_name='infopage', + name='title_en', + field=models.CharField(max_length=120, null=True, verbose_name='title', blank=True), + ), + migrations.AlterField( + model_name='infopage', + name='title_es', + field=models.CharField(max_length=120, null=True, verbose_name='title', blank=True), + ), + migrations.AlterField( + model_name='infopage', + name='title_fr', + field=models.CharField(max_length=120, null=True, verbose_name='title', blank=True), + ), + migrations.AlterField( + model_name='infopage', + name='title_it', + field=models.CharField(max_length=120, null=True, verbose_name='title', blank=True), + ), + migrations.AlterField( + model_name='infopage', + name='title_lt', + field=models.CharField(max_length=120, null=True, verbose_name='title', blank=True), + ), + migrations.AlterField( + model_name='infopage', + name='title_pl', + field=models.CharField(max_length=120, null=True, verbose_name='title', blank=True), + ), + migrations.AlterField( + model_name='infopage', + name='title_ru', + field=models.CharField(max_length=120, null=True, verbose_name='title', blank=True), + ), + migrations.AlterField( + model_name='infopage', + name='title_uk', + field=models.CharField(max_length=120, null=True, verbose_name='title', blank=True), + ), + ] diff --git a/apps/lesmianator/migrations/0002_auto_20151221_1225.py b/apps/lesmianator/migrations/0002_auto_20151221_1225.py new file mode 100644 index 000000000..29a33a85c --- /dev/null +++ b/apps/lesmianator/migrations/0002_auto_20151221_1225.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import jsonfield.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('lesmianator', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='poem', + name='created_from', + field=jsonfield.fields.JSONField(null=True, verbose_name='extra information', blank=True), + ), + migrations.AlterField( + model_name='poem', + name='slug', + field=models.SlugField(max_length=120, verbose_name='slug'), + ), + ] diff --git a/apps/libraries/migrations/0002_auto_20151221_1225.py b/apps/libraries/migrations/0002_auto_20151221_1225.py new file mode 100644 index 000000000..123580d91 --- /dev/null +++ b/apps/libraries/migrations/0002_auto_20151221_1225.py @@ -0,0 +1,29 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('libraries', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='catalog', + name='slug', + field=models.SlugField(unique=True, max_length=120, verbose_name='slug'), + ), + migrations.AlterField( + model_name='library', + name='description', + field=models.TextField(verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='library', + name='slug', + field=models.SlugField(max_length=120, unique=True, null=True, verbose_name='slug'), + ), + ] diff --git a/apps/pdcounter/migrations/0002_auto_20151221_1225.py b/apps/pdcounter/migrations/0002_auto_20151221_1225.py new file mode 100644 index 000000000..6447cc1d4 --- /dev/null +++ b/apps/pdcounter/migrations/0002_auto_20151221_1225.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('pdcounter', '0001_initial'), + ] + + operations = [ + migrations.AlterModelOptions( + name='bookstub', + options={'ordering': ('title',), 'verbose_name': 'book stub', 'verbose_name_plural': 'book stubs'}, + ), + migrations.AlterField( + model_name='author', + name='death', + field=models.IntegerField(null=True, verbose_name='year of death', blank=True), + ), + migrations.AlterField( + model_name='author', + name='description', + field=models.TextField(verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='author', + name='slug', + field=models.SlugField(unique=True, max_length=120, verbose_name='slug'), + ), + migrations.AlterField( + model_name='author', + name='sort_key', + field=models.CharField(max_length=120, verbose_name='sort key', db_index=True), + ), + migrations.AlterField( + model_name='bookstub', + name='pd', + field=models.IntegerField(null=True, verbose_name='goes to public domain', blank=True), + ), + migrations.AlterField( + model_name='bookstub', + name='slug', + field=models.SlugField(unique=True, max_length=120, verbose_name='slug'), + ), + migrations.AlterField( + model_name='bookstub', + name='title', + field=models.CharField(max_length=120, verbose_name='title'), + ), + migrations.AlterField( + model_name='bookstub', + name='translator', + field=models.TextField(verbose_name='translator', blank=True), + ), + ] diff --git a/apps/picture/migrations/0006_auto_20151221_1225.py b/apps/picture/migrations/0006_auto_20151221_1225.py new file mode 100644 index 000000000..2f03ce591 --- /dev/null +++ b/apps/picture/migrations/0006_auto_20151221_1225.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +import jsonfield.fields + + +class Migration(migrations.Migration): + + dependencies = [ + ('picture', '0005_auto_20141022_1001'), + ] + + operations = [ + migrations.AlterField( + model_name='picture', + name='extra_info', + field=jsonfield.fields.JSONField(default={}, verbose_name='extra information'), + ), + migrations.AlterField( + model_name='picture', + name='slug', + field=models.SlugField(unique=True, max_length=120, verbose_name='slug'), + ), + migrations.AlterField( + model_name='picture', + name='sort_key', + field=models.CharField(verbose_name='sort key', max_length=120, editable=False, db_index=True), + ), + migrations.AlterField( + model_name='picture', + name='title', + field=models.CharField(max_length=32767, verbose_name='title'), + ), + migrations.AlterField( + model_name='picturearea', + name='kind', + field=models.CharField(db_index=True, max_length=10, verbose_name='kind', choices=[(b'thing', 'thing'), (b'theme', 'theme')]), + ), + ] diff --git a/apps/picture/models.py b/apps/picture/models.py index ee2b4e001..5aabe3c89 100644 --- a/apps/picture/models.py +++ b/apps/picture/models.py @@ -150,7 +150,7 @@ class Picture(models.Model): xml_file = File(open(xml_file)) close_xml_file = True - try: + with transaction.atomic(): # use librarian to parse meta-data if image_store is None: image_store = ImageStore(picture_storage.path('images')) @@ -240,18 +240,10 @@ class Picture(models.Model): picture.save() tasks.generate_picture_html(picture.id) - except Exception, ex: - logging.exception("Exception during import, rolling back") - transaction.rollback() - raise ex - - finally: - if close_xml_file: - xml_file.close() - if close_image_file: - image_file.close() - - transaction.commit() + if close_xml_file: + xml_file.close() + if close_image_file: + image_file.close() return picture diff --git a/apps/picture/templates/picture/picture_viewer.html b/apps/picture/templates/picture/picture_viewer.html index a1fb99119..e169dbe0f 100644 --- a/apps/picture/templates/picture/picture_viewer.html +++ b/apps/picture/templates/picture/picture_viewer.html @@ -1,7 +1,7 @@ {% extends "catalogue/viewer_base.html" %} {% load i18n %} {% load static from staticfiles %} -{% load compressed catalogue_tags %} +{% load catalogue_tags %} {% load thumbnail %} diff --git a/apps/polls/migrations/0002_auto_20151221_1225.py b/apps/polls/migrations/0002_auto_20151221_1225.py new file mode 100644 index 000000000..e75948893 --- /dev/null +++ b/apps/polls/migrations/0002_auto_20151221_1225.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('polls', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='poll', + name='slug', + field=models.SlugField(verbose_name='slug'), + ), + ] diff --git a/apps/social/migrations/0002_auto_20151221_1225.py b/apps/social/migrations/0002_auto_20151221_1225.py new file mode 100644 index 000000000..f26e4f8fc --- /dev/null +++ b/apps/social/migrations/0002_auto_20151221_1225.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('social', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='cite', + name='image_title', + field=models.CharField(max_length=255, null=True, verbose_name='title', blank=True), + ), + ] diff --git a/apps/sponsors/migrations/0002_auto_20151221_1225.py b/apps/sponsors/migrations/0002_auto_20151221_1225.py new file mode 100644 index 000000000..0110a8896 --- /dev/null +++ b/apps/sponsors/migrations/0002_auto_20151221_1225.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sponsors', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='sponsor', + name='_description', + field=models.CharField(max_length=255, verbose_name='description', blank=True), + ), + ] diff --git a/apps/suggest/migrations/0002_auto_20151221_1225.py b/apps/suggest/migrations/0002_auto_20151221_1225.py new file mode 100644 index 000000000..126808b68 --- /dev/null +++ b/apps/suggest/migrations/0002_auto_20151221_1225.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('suggest', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='publishingsuggestion', + name='books', + field=models.TextField(null=True, verbose_name='books', blank=True), + ), + migrations.AlterField( + model_name='publishingsuggestion', + name='contact', + field=models.CharField(max_length=120, verbose_name='contact', blank=True), + ), + migrations.AlterField( + model_name='suggestion', + name='contact', + field=models.CharField(max_length=120, verbose_name='contact', blank=True), + ), + migrations.AlterField( + model_name='suggestion', + name='description', + field=models.TextField(verbose_name='description', blank=True), + ), + ] diff --git a/apps/wolnelektury_core/templates/superbase.html b/apps/wolnelektury_core/templates/superbase.html index c3259a30b..08d60a32a 100644 --- a/apps/wolnelektury_core/templates/superbase.html +++ b/apps/wolnelektury_core/templates/superbase.html @@ -1,7 +1,7 @@ {% spaceless %} - {% load compressed i18n %} + {% load pipeline i18n %} {% load static from staticfiles %} {% load catalogue_tags funding_tags reporting_stats %} {% load piwik_tags %} @@ -21,7 +21,7 @@ {% block title %}{% trans "Wolne Lektury" %} :: {% block titleextra %}{% endblock %}{% endblock %} - {% compressed_css "main" %} + {% stylesheet "main" %} {% block extrahead %} {% endblock %} @@ -140,7 +140,7 @@ - {% compressed_js "base" %} + {% javascript "base" %} {% tracking_code %} @@ -150,4 +150,4 @@ -{% endspaceless %} \ No newline at end of file +{% endspaceless %} diff --git a/apps/wolnelektury_core/templates/widget.html b/apps/wolnelektury_core/templates/widget.html index bfd0358e0..444f466ab 100644 --- a/apps/wolnelektury_core/templates/widget.html +++ b/apps/wolnelektury_core/templates/widget.html @@ -1,7 +1,7 @@ {% spaceless %} {% load static from staticfiles %} -{% load compressed %} +{% load pipeline %} @@ -9,7 +9,7 @@ Widget Wolnych Lektur - {% compressed_css 'widget' %} + {% stylesheet 'widget' %}
@@ -29,9 +29,9 @@
-{% compressed_js 'widget' %} +{% javascript 'widget' %} -{% endspaceless %} \ No newline at end of file +{% endspaceless %} diff --git a/requirements-test.txt b/requirements-test.txt index e95f91a65..063cd7837 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,7 +1,7 @@ -i https://py.mdrn.pl:8443/simple/ -nose>=0.11 -django-nose +nose>=1.3.7 +django-nose>=1.4.2,<1.5 nosexcover polib mock diff --git a/requirements.txt b/requirements.txt index 7bed40f48..fcd41c474 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,19 +1,18 @@ -i https://py.mdrn.pl:8443/simple/ # django -Django>=1.7,<1.8 +Django>=1.8,<1.9 fnpdjango>=0.1.15,<0.2 -django-pipeline>=1.3,<1.4 +django-pipeline>=1.6,<1.7 jsmin django-pagination>=1.0 django-maintenancemode>=0.10 django-piston==0.2.2.1.2 -jsonfield>=0.9.22,<1.0 +jsonfield>=1.0.3,<1.1 django-picklefield -django-modeltranslation==0.8b2 -# django-allauth>=0.17,<0.18 -# django-allauth pre-0.18 version with Django 1.7 migrations --e git+git://github.com/pennersr/django-allauth.git@9cc09402d3dd768bc1221e0bb7a438d6295812f5#egg=django-allauth +django-modeltranslation>=0.10,<0.11 +django-allauth>=0.24,<0.25 + pytz @@ -24,12 +23,12 @@ python-memcached django-piwik python-fb -# Feedparser +# Feedparser Feedparser>=5.1 Pillow mutagen>=1.17 -sorl-thumbnail>=11.12.1b,<11.13 +sorl-thumbnail>=12.3,<12.4 # home-brewed & dependencies lxml>=2.2.2 @@ -39,7 +38,7 @@ lxml>=2.2.2 # celery tasks celery>=3.1.12,<3.2 --e git+git://github.com/rczajka/kombu.git@4ed3622d1e801811410eda503e3eb8a6efd7f86f#egg=kombu +kombu>=3.0.23,<3.1 # spell checking pyenchant @@ -50,7 +49,7 @@ pyoai ## egenix-mx-base # Doesn't play nice with mx in dist-packages. sunburnt -django-getpaid>=1.6,<1.7 +django-getpaid>=1.7,<1.8 httplib2 Texml django-ssify>=0.2.1,<0.3 diff --git a/wolnelektury/migrations/getpaid/0002_auto_20151221_1225.py b/wolnelektury/migrations/getpaid/0002_auto_20151221_1225.py new file mode 100644 index 000000000..c1a71771f --- /dev/null +++ b/wolnelektury/migrations/getpaid/0002_auto_20151221_1225.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('getpaid', '0001_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='payment', + name='description', + field=models.CharField(max_length=128, null=True, verbose_name='description', blank=True), + ), + migrations.AlterField( + model_name='payment', + name='status', + field=models.CharField(default=b'new', max_length=20, verbose_name='status', db_index=True, choices=[(b'new', 'new'), (b'in_progress', 'in progress'), (b'accepted_for_proc', 'accepted for processing'), (b'partially_paid', 'partially paid'), (b'paid', 'paid'), (b'cancelled', 'cancelled'), (b'failed', 'failed')]), + ), + ] diff --git a/wolnelektury/migrations/piston/0001_initial.py b/wolnelektury/migrations/piston/0001_initial.py new file mode 100644 index 000000000..c2939b19a --- /dev/null +++ b/wolnelektury/migrations/piston/0001_initial.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import migrations, models +from django.conf import settings + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Consumer', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=255)), + ('description', models.TextField()), + ('key', models.CharField(max_length=18)), + ('secret', models.CharField(max_length=32)), + ('status', models.CharField(default=b'pending', max_length=16, choices=[(b'pending', b'Pending approval'), (b'accepted', b'Accepted'), (b'canceled', b'Canceled')])), + ('user', models.ForeignKey(related_name='consumers', blank=True, to=settings.AUTH_USER_MODEL, null=True)), + ], + ), + migrations.CreateModel( + name='Nonce', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('token_key', models.CharField(max_length=18)), + ('consumer_key', models.CharField(max_length=18)), + ('key', models.CharField(max_length=255)), + ], + ), + migrations.CreateModel( + name='Resource', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('name', models.CharField(max_length=255)), + ('url', models.TextField(max_length=2047)), + ('is_readonly', models.BooleanField(default=True)), + ], + ), + migrations.CreateModel( + name='Token', + fields=[ + ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ('key', models.CharField(max_length=18)), + ('secret', models.CharField(max_length=32)), + ('token_type', models.IntegerField(choices=[(1, 'Request'), (2, 'Access')])), + ('timestamp', models.IntegerField()), + ('is_approved', models.BooleanField(default=False)), + ('consumer', models.ForeignKey(to='piston.Consumer')), + ('user', models.ForeignKey(related_name='tokens', blank=True, to=settings.AUTH_USER_MODEL, null=True)), + ], + ), + ] diff --git a/wolnelektury/migrations/piston/__init__.py b/wolnelektury/migrations/piston/__init__.py new file mode 100644 index 000000000..e69de29bb diff --git a/wolnelektury/settings/__init__.py b/wolnelektury/settings/__init__.py index 4f6194096..9224484de 100644 --- a/wolnelektury/settings/__init__.py +++ b/wolnelektury/settings/__init__.py @@ -20,9 +20,6 @@ TEMPLATE_CONTEXT_PROCESSORS = ( 'django.core.context_processors.request', 'wolnelektury_core.context_processors.extra_settings', 'search.context_processors.search_form', - - "allauth.account.context_processors.account", - "allauth.socialaccount.context_processors.socialaccount", ) MIDDLEWARE_CLASSES = [ diff --git a/wolnelektury/settings/contrib.py b/wolnelektury/settings/contrib.py index 3645c1d1c..f0e8430a5 100644 --- a/wolnelektury/settings/contrib.py +++ b/wolnelektury/settings/contrib.py @@ -7,6 +7,7 @@ MODELTRANSLATION_PREPOPULATE_LANGUAGE = 'pl' MIGRATION_MODULES = { 'getpaid' : 'wolnelektury.migrations.getpaid', + 'piston' : 'wolnelektury.migrations.piston', } GETPAID_ORDER_DESCRIPTION = "{% load funding_tags %}{{ order|sanitize_payment_title }}" diff --git a/wolnelektury/settings/static.py b/wolnelektury/settings/static.py index ebce200f3..a5d7bb7c4 100644 --- a/wolnelektury/settings/static.py +++ b/wolnelektury/settings/static.py @@ -15,8 +15,8 @@ STATIC_URL = '/static/' # CSS and JavaScript file groups - -PIPELINE_CSS = { +PIPELINE = { + 'STYLESHEETS': { 'main': { # styles both for mobile and for big screen 'source_filenames': [ @@ -70,9 +70,8 @@ PIPELINE_CSS = { 'source_filenames': ('scss/widget.scss',), 'output_filename': 'css/compressed/widget.css', }, -} - -PIPELINE_JS = { + }, + 'JAVASCRIPT': { 'base': { 'source_filenames': ( 'js/contrib/jquery.cycle.min.js', @@ -149,19 +148,27 @@ PIPELINE_JS = { ), 'output_filename': 'js/widget.min.js', }, + }, + 'CSS_COMPRESSOR': None, + 'JS_COMPRESSOR': 'pipeline.compressors.jsmin.JSMinCompressor', + 'COMPILERS': ( + 'pipeline.compilers.sass.SASSCompiler', + # We could probably use PySCSS instead, + # but they have some serious problems, like: + # https://github.com/Kronuz/pyScss/issues/166 (empty list syntax) + # https://github.com/Kronuz/pyScss/issues/258 (bad @media order) + #'pyscss_compiler.PySCSSCompiler', + ) } -STATICFILES_STORAGE = 'fnpdjango.utils.pipeline_storage.GzipPipelineCachedStorage' -PIPELINE_CSS_COMPRESSOR = None -PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.jsmin.JSMinCompressor' - -PIPELINE_COMPILERS = ( - 'pipeline.compilers.sass.SASSCompiler', - # We could probably use PySCSS instead, - # but they have some serious problems, like: - # https://github.com/Kronuz/pyScss/issues/166 (empty list syntax) - # https://github.com/Kronuz/pyScss/issues/258 (bad @media order) - #'pyscss_compiler.PySCSSCompiler', -) +#~ STATICFILES_STORAGE = 'fnpdjango.utils.pipeline_storage.GzipPipelineCachedStorage' + #PIPELINE_PYSCSS_BINARY = '/usr/bin/env pyscss' #PIPELINE_PYSCSS_ARGUMENTS = '' + + +STATICFILES_FINDERS = [ + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', + 'pipeline.finders.PipelineFinder', +] diff --git a/wolnelektury/urls.py b/wolnelektury/urls.py index bdfb474fd..a77a3d1b4 100644 --- a/wolnelektury/urls.py +++ b/wolnelektury/urls.py @@ -70,15 +70,15 @@ urlpatterns += patterns('', urlpatterns += patterns('', # old static pages - redirected url(r'^1procent/$', RedirectView.as_view( - url='http://nowoczesnapolska.org.pl/wesprzyj_nas/')), + url='http://nowoczesnapolska.org.pl/wesprzyj_nas/', permanent=True)), url(r'^epub/$', RedirectView.as_view( - url='/katalog/lektury/')), + url='/katalog/lektury/', permanent=False)), url(r'^mozesz-nam-pomoc/$', RedirectView.as_view( - url='/info/mozesz-nam-pomoc')), + url='/info/mozesz-nam-pomoc', permanent=True)), url(r'^o-projekcie/$', RedirectView.as_view( - url='/info/o-projekcie')), + url='/info/o-projekcie', permanent=True)), url(r'^widget/$', RedirectView.as_view( - url='/info/widget')), + url='/info/widget', permanent=True)), url(r'^wolontariat/$', RedirectView.as_view( - url='/info/mozesz-nam-pomoc/')), + url='/info/mozesz-nam-pomoc/', permanent=False)), )