Django 1.9.
authorRadek Czajka <rczajka@rczajka.pl>
Thu, 14 Feb 2019 21:21:19 +0000 (22:21 +0100)
committerRadek Czajka <rczajka@rczajka.pl>
Thu, 14 Feb 2019 21:21:19 +0000 (22:21 +0100)
35 files changed:
requirements/requirements.txt
src/api/urls.py
src/catalogue/models/book.py
src/catalogue/models/collection.py
src/catalogue/urls.py
src/catalogue/views.py
src/chunks/urls.py
src/contact/admin.py
src/contact/urls.py
src/dictionary/urls.py
src/funding/urls.py
src/funding/views.py
src/infopages/urls.py
src/lesmianator/urls.py
src/libraries/urls.py
src/oai/handlers.py
src/oai/urls.py
src/opds/urls.py
src/paypal/tests.py
src/picture/models.py
src/picture/views.py
src/polls/urls.py
src/push/urls.py
src/reporting/urls.py
src/search/urls.py
src/social/urls.py
src/sponsors/urls.py
src/suggest/urls.py
src/waiter/urls.py
src/wolnelektury/settings/apps.py
src/wolnelektury/settings/basic.py
src/wolnelektury/settings/static.py
src/wolnelektury/templates/base/superbase.html
src/wolnelektury/templates/openid/login.html
src/wolnelektury/templates/socialaccount/connections.html

index 7122431..fd98553 100644 (file)
@@ -1,15 +1,15 @@
--i https://py.mdrn.pl:8443/simple/
+-i https://py.mdrn.pl/simple/
 
 # django
-Django>=1.8,<1.9
+Django>=1.9,<1.10
 fnpdjango>=0.2.8,<0.3
 django-pipeline>=1.6,<1.7
 jsmin
 fnp-django-pagination
 django-maintenancemode==0.10
-jsonfield>=1.0.3,<1.1
+jsonfield==2.0.2
 django-picklefield>=1.0,<1.1
-django-modeltranslation>=0.10,<0.11
+django-modeltranslation==0.11
 django-allauth>=0.32,<0.33
 django-extensions
 djangorestframework<3.7
@@ -20,12 +20,11 @@ oauthlib>=3.0.1,<3.1
 pyyaml
 
 polib
-django-babel
+django-babel==0.5.0
 
 pytz
 
-django-honeypot
-django-uni-form
+django-honeypot==0.6.0
 
 python-memcached
 django-piwik
@@ -57,10 +56,12 @@ pyoai==2.4.4
 ## egenix-mx-base  # Doesn't play nice with mx in dist-packages.
 sunburnt
 
-django-getpaid>=1.7,<1.8
+#django-getpaid==1.7.4
+-e git+https://github.com/django-getpaid/django-getpaid.git@v1.7.4#egg=django-getpaid
+
 httplib2
 Texml
-django-ssify>=0.2.1,<0.3
+django-ssify>=0.2.6,<0.3
 
 raven
 
index 16fdfb7..9c8dab2 100644 (file)
@@ -36,7 +36,7 @@ urlpatterns = [
     url(r'^blog/$',
         piwik_track_view(views.BlogView.as_view())),
 
-    url(r'^pictures/$', include('picture.api.urls')),
+    url(r'^pictures/', include('picture.api.urls')),
     url(r'^', include('social.api.urls')),
     url(r'^', include('catalogue.api.urls')),
 ]
index b2289f6..068bae8 100644 (file)
@@ -205,12 +205,12 @@ class Book(models.Model):
 
     @permalink
     def get_absolute_url(self):
-        return 'catalogue.views.book_detail', [self.slug]
+        return 'book_detail', [self.slug]
 
     @staticmethod
     @permalink
     def create_url(slug):
-        return 'catalogue.views.book_detail', [slug]
+        return 'book_detail', [slug]
 
     def gallery_path(self):
         return gallery_path(self.slug)
index e952043..b765abe 100644 (file)
@@ -40,7 +40,6 @@ class Collection(models.Model):
     def get_query(self):
         slugs = self.book_slugs.split()
         # allow URIs
-        # WTF
         slugs = [slug.rstrip('/').rsplit('/', 1)[-1] if '/' in slug else slug for slug in slugs]
         return models.Q(slug__in=slugs)
 
index 50a4a4a..8b37e07 100644 (file)
@@ -2,54 +2,47 @@
 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.conf.urls import patterns, url
+from django.conf.urls import url
 from django.db.models import Max
 from django.views.generic import ListView, RedirectView
 from catalogue.feeds import AudiobookFeed
-from catalogue.views import CustomPDFFormView
 from catalogue.models import Book
+from catalogue import views
+import picture.views
 
 
 SLUG = r'[a-z0-9-]*'
 
-urlpatterns = patterns(
-    'picture.views',
-
-    url(r'^obraz/strona/$', 'picture_page', name='picture_page'),
+urlpatterns = [
+    url(r'^obraz/strona/$', picture.views.picture_page, name='picture_page'),
     # pictures - currently pictures are coupled with catalogue, hence the url is here
-    url(r'^obraz/$', 'picture_list_thumb', name='picture_list_thumb'),
-    url(r'^obraz/(?P<slug>%s).html$' % SLUG, 'picture_viewer', name='picture_viewer'),
-    url(r'^obraz/(?P<slug>%s)/$' % SLUG, 'picture_detail'),
+    url(r'^obraz/$', picture.views.picture_list_thumb, name='picture_list_thumb'),
+    url(r'^obraz/(?P<slug>%s).html$' % SLUG, picture.views.picture_viewer, name='picture_viewer'),
+    url(r'^obraz/(?P<slug>%s)/$' % SLUG, picture.views.picture_detail),
 
-    url(r'^p/(?P<pk>\d+)/mini\.(?P<lang>.+)\.html', 'picture_mini', name='picture_mini'),
-    url(r'^p/(?P<pk>\d+)/short\.(?P<lang>.+)\.html', 'picture_short', name='picture_short'),
-    url(r'^pa/(?P<pk>\d+)/short\.(?P<lang>.+)\.html', 'picturearea_short', name='picture_area_short'),
-)
+    url(r'^p/(?P<pk>\d+)/mini\.(?P<lang>.+)\.html', picture.views.picture_mini, name='picture_mini'),
+    url(r'^p/(?P<pk>\d+)/short\.(?P<lang>.+)\.html', picture.views.picture_short, name='picture_short'),
+    url(r'^pa/(?P<pk>\d+)/short\.(?P<lang>.+)\.html', picture.views.picturearea_short, name='picture_area_short'),
 
-urlpatterns += patterns(
-    '',
     # old search page - redirected
     url(r'^szukaj/$', RedirectView.as_view(
             url='/szukaj/', query_string=True, permanent=True)),
-)
 
-urlpatterns += patterns(
-    'catalogue.views',
-    url(r'^$', 'catalogue', name='catalogue'),
+    url(r'^$', views.catalogue, name='catalogue'),
 
-    url(r'^autor/$', 'tag_catalogue', {'category': 'author'}, name='author_catalogue'),
-    url(r'^epoka/$', 'tag_catalogue', {'category': 'epoch'}, name='epoch_catalogue'),
-    url(r'^gatunek/$', 'tag_catalogue', {'category': 'genre'}, name='genre_catalogue'),
-    url(r'^rodzaj/$', 'tag_catalogue', {'category': 'kind'}, name='kind_catalogue'),
-    url(r'^motyw/$', 'tag_catalogue', {'category': 'theme'}, name='theme_catalogue'),
+    url(r'^autor/$', views.tag_catalogue, {'category': 'author'}, name='author_catalogue'),
+    url(r'^epoka/$', views.tag_catalogue, {'category': 'epoch'}, name='epoch_catalogue'),
+    url(r'^gatunek/$', views.tag_catalogue, {'category': 'genre'}, name='genre_catalogue'),
+    url(r'^rodzaj/$', views.tag_catalogue, {'category': 'kind'}, name='kind_catalogue'),
+    url(r'^motyw/$', views.tag_catalogue, {'category': 'theme'}, name='theme_catalogue'),
 
-    url(r'^galeria/$', 'gallery', name='gallery'),
-    url(r'^kolekcje/$', 'collections', name='catalogue_collections'),
+    url(r'^galeria/$', views.gallery, name='gallery'),
+    url(r'^kolekcje/$', views.collections, name='catalogue_collections'),
 
-    url(r'^lektury/$', 'literature', name='book_list'),
-    url(r'^lektury/(?P<slug>[a-zA-Z0-9-]+)/$', 'collection', name='collection'),
-    url(r'^audiobooki/$', 'audiobooks', name='audiobook_list'),
-    url(r'^daisy/$', 'daisy_list', name='daisy_list'),
+    url(r'^lektury/$', views.literature, name='book_list'),
+    url(r'^lektury/(?P<slug>[a-zA-Z0-9-]+)/$', views.collection, name='collection'),
+    url(r'^audiobooki/$', views.audiobooks, name='audiobook_list'),
+    url(r'^daisy/$', views.daisy_list, name='daisy_list'),
     url(r'^nowe/$', ListView.as_view(
         queryset=Book.objects.filter(parent=None).order_by('-created_at'),
         template_name='catalogue/recent_list.html'), name='recent_list'),
@@ -60,45 +53,45 @@ urlpatterns += patterns(
         queryset=Book.objects.filter(media__type='daisy').annotate(m=Max('media__uploaded_at')).order_by('-m'),
         template_name='catalogue/recent_daisy_list.html'), name='recent_daisy_list'),
 
-    url(r'^custompdf/(?P<slug>%s)/$' % SLUG, CustomPDFFormView(), name='custom_pdf_form'),
+    url(r'^custompdf/(?P<slug>%s)/$' % SLUG, views.CustomPDFFormView(), name='custom_pdf_form'),
 
     url(r'^audiobooki/(?P<type>mp3|ogg|daisy|all).xml$', AudiobookFeed(), name='audiobook_feed'),
 
-    url(r'^pobierz/(?P<slug>%s).(?P<format_>[a-z0-9]*)$' % SLUG, 'embargo_link', name='embargo_link'),
+    url(r'^pobierz/(?P<slug>%s).(?P<format_>[a-z0-9]*)$' % SLUG, views.embargo_link, name='embargo_link'),
 
     # zip
-    url(r'^zip/pdf\.zip$', 'download_zip', {'format': 'pdf', 'slug': None}, 'download_zip_pdf'),
-    url(r'^zip/epub\.zip$', 'download_zip', {'format': 'epub', 'slug': None}, 'download_zip_epub'),
-    url(r'^zip/mobi\.zip$', 'download_zip', {'format': 'mobi', 'slug': None}, 'download_zip_mobi'),
-    url(r'^zip/mp3/(?P<slug>%s)\.zip' % SLUG, 'download_zip', {'format': 'mp3'}, 'download_zip_mp3'),
-    url(r'^zip/ogg/(?P<slug>%s)\.zip' % SLUG, 'download_zip', {'format': 'ogg'}, 'download_zip_ogg'),
+    url(r'^zip/pdf\.zip$', views.download_zip, {'format': 'pdf', 'slug': None}, 'download_zip_pdf'),
+    url(r'^zip/epub\.zip$', views.download_zip, {'format': 'epub', 'slug': None}, 'download_zip_epub'),
+    url(r'^zip/mobi\.zip$', views.download_zip, {'format': 'mobi', 'slug': None}, 'download_zip_mobi'),
+    url(r'^zip/mp3/(?P<slug>%s)\.zip' % SLUG, views.download_zip, {'format': 'mp3'}, 'download_zip_mp3'),
+    url(r'^zip/ogg/(?P<slug>%s)\.zip' % SLUG, views.download_zip, {'format': 'ogg'}, 'download_zip_ogg'),
 
     # Public interface. Do not change this URLs.
-    url(r'^lektura/(?P<slug>%s)\.html$' % SLUG, 'book_text', name='book_text'),
-    url(r'^lektura/(?P<slug>%s)/audiobook/$' % SLUG, 'player', name='book_player'),
-    url(r'^lektura/(?P<slug>%s)/$' % SLUG, 'book_detail', name='book_detail'),
+    url(r'^lektura/(?P<slug>%s)\.html$' % SLUG, views.book_text, name='book_text'),
+    url(r'^lektura/(?P<slug>%s)/audiobook/$' % SLUG, views.player, name='book_player'),
+    url(r'^lektura/(?P<slug>%s)/$' % SLUG, views.book_detail, name='book_detail'),
     url(r'^lektura/(?P<slug>%s)/motyw/(?P<theme_slug>[a-zA-Z0-9-]+)/$' % SLUG,
-        'book_fragments', name='book_fragments'),
+        views.book_fragments, name='book_fragments'),
 
-    url(r'^okladka-ridero/(?P<slug>%s).png$' % SLUG, 'ridero_cover'),
-    url(r'^isbn/(?P<book_format>(pdf|epub|mobi|txt|html))/(?P<slug>%s)/' % SLUG, 'get_isbn'),
+    url(r'^okladka-ridero/(?P<slug>%s).png$' % SLUG, views.ridero_cover),
+    url(r'^isbn/(?P<book_format>(pdf|epub|mobi|txt|html))/(?P<slug>%s)/' % SLUG, views.get_isbn),
 
     # Includes.
-    url(r'^b/(?P<pk>\d+)/mini\.(?P<lang>.+)\.html', 'book_mini', name='catalogue_book_mini'),
-    url(r'^b/(?P<pk>\d+)/mini_nolink\.(?P<lang>.+)\.html', 'book_mini', {'with_link': False},
+    url(r'^b/(?P<pk>\d+)/mini\.(?P<lang>.+)\.html', views.book_mini, name='catalogue_book_mini'),
+    url(r'^b/(?P<pk>\d+)/mini_nolink\.(?P<lang>.+)\.html', views.book_mini, {'with_link': False},
         name='catalogue_book_mini_nolink'),
-    url(r'^b/(?P<pk>\d+)/short\.(?P<lang>.+)\.html', 'book_short', name='catalogue_book_short'),
-    url(r'^b/(?P<pk>\d+)/wide\.(?P<lang>.+)\.html', 'book_wide', name='catalogue_book_wide'),
-    url(r'^f/(?P<pk>\d+)/promo\.(?P<lang>.+)\.html', 'fragment_promo', name='catalogue_fragment_promo'),
-    url(r'^f/(?P<pk>\d+)/short\.(?P<lang>.+)\.html', 'fragment_short', name='catalogue_fragment_short'),
-    url(r'^t/(?P<pk>\d+)/box\.(?P<lang>.+)\.html', 'tag_box', name='catalogue_tag_box'),
-    url(r'^c/(?P<pk>.+)/box\.(?P<lang>.+)\.html', 'collection_box', name='catalogue_collection_box'),
+    url(r'^b/(?P<pk>\d+)/short\.(?P<lang>.+)\.html', views.book_short, name='catalogue_book_short'),
+    url(r'^b/(?P<pk>\d+)/wide\.(?P<lang>.+)\.html', views.book_wide, name='catalogue_book_wide'),
+    url(r'^f/(?P<pk>\d+)/promo\.(?P<lang>.+)\.html', views.fragment_promo, name='catalogue_fragment_promo'),
+    url(r'^f/(?P<pk>\d+)/short\.(?P<lang>.+)\.html', views.fragment_short, name='catalogue_fragment_short'),
+    url(r'^t/(?P<pk>\d+)/box\.(?P<lang>.+)\.html', views.tag_box, name='catalogue_tag_box'),
+    url(r'^c/(?P<pk>.+)/box\.(?P<lang>.+)\.html', views.collection_box, name='catalogue_collection_box'),
 
     # This should be the last pattern.
-    url(r'^galeria/(?P<tags>[a-zA-Z0-9-/]*)/$', 'tagged_object_list', {'list_type': 'gallery'},
+    url(r'^galeria/(?P<tags>[a-zA-Z0-9-/]*)/$', views.tagged_object_list, {'list_type': 'gallery'},
         name='tagged_object_list_gallery'),
-    url(r'^audiobooki/(?P<tags>[a-zA-Z0-9-/]*)/$', 'tagged_object_list', {'list_type': 'audiobooks'},
+    url(r'^audiobooki/(?P<tags>[a-zA-Z0-9-/]*)/$', views.tagged_object_list, {'list_type': 'audiobooks'},
         name='tagged_object_list_audiobooks'),
-    url(r'^(?P<tags>[a-zA-Z0-9-/]*)/$', 'tagged_object_list', {'list_type': 'books'},
+    url(r'^(?P<tags>[a-zA-Z0-9-/]*)/$', views.tagged_object_list, {'list_type': 'books'},
         name='tagged_object_list'),
-)
+]
index f6d6cd5..2e43bd0 100644 (file)
@@ -52,7 +52,6 @@ def book_list(request, filters=None, template_name='catalogue/book_list.html',
     for tag in books_by_author:
         if books_by_author[tag]:
             books_nav.setdefault(tag.sort_key[0], []).append(tag)
-    # WTF: dlaczego nie include?
     return render_to_response(template_name, {
         'rendered_nav': render_to_string(nav_template_name, {'books_nav': books_nav}),
         'rendered_book_list': render_to_string(list_template_name, {
index 89472f9..0536a18 100644 (file)
@@ -2,9 +2,10 @@
 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.conf.urls import patterns, url
+from django.conf.urls import url
+from . import views
 
-urlpatterns = patterns(
-    'chunks.views',
-    url(r'^chunk/(?P<key>.+)\.(?P<lang>.+)\.html$', 'chunk', name='chunk'),
-)
+
+urlpatterns = [
+    url(r'^chunk/(?P<key>.+)\.(?P<lang>.+)\.html$', views.chunk, name='chunk'),
+]
index af14c6b..4109509 100644 (file)
@@ -5,7 +5,7 @@ import json
 from django.contrib import admin
 from django.utils.translation import ugettext as _
 from django.utils.safestring import mark_safe
-from django.conf.urls import patterns, url
+from django.conf.urls import url
 from django.http import HttpResponse, Http404
 
 from wolnelektury.utils import UnicodeCSVWriter
@@ -104,12 +104,10 @@ class ContactAdmin(admin.ModelAdmin):
         return super(ContactAdmin, self).changelist_view(request, extra_context=context)
 
     def get_urls(self):
-        # urls = super(ContactAdmin, self).get_urls()
-        return patterns(
-            '',
+        return [
             url(r'^extract/(?P<form_tag>[\w-]+)/(?P<extract_type_slug>[\w-]+)/$',
                 self.admin_site.admin_view(extract_view), name='contact_extract')
-        ) + super(ContactAdmin, self).get_urls()
+        ] + super(ContactAdmin, self).get_urls()
 
 
 def extract_view(request, form_tag, extract_type_slug):
index f2ef944..c475cd4 100644 (file)
@@ -1,11 +1,11 @@
 # -*- coding: utf-8 -*-
-from django.conf.urls import patterns, url
+from django.conf.urls import url
 from . import views
 
-urlpatterns = patterns(
-    'contact.views',
+
+urlpatterns = [
     url(r'^(?P<form_tag>[^/]+)/$', views.form, name='contact_form'),
     url(r'^(?P<form_tag>[^/]+)/thanks/$', views.thanks, name='contact_thanks'),
     url(r'^attachment/(?P<contact_id>\d+)/(?P<tag>[^/]+)/$', views.attachment, name='contact_attachment'),
     url(r'^results/(?P<contact_id>\d+)/(?P<digest>[0-9a-f]+)/', views.results, name='contact_results'),
-)
+]
index 6df9a47..a5582a1 100755 (executable)
@@ -2,10 +2,9 @@
 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.conf.urls import patterns, url
+from django.conf.urls import url
 from dictionary.views import NotesView
 
-urlpatterns = patterns(
-    'dictionary.views',
+urlpatterns = [
     url(r'^$', NotesView.as_view(), name='dictionary_notes'),
-)
+]
index 1f0d494..f8afc66 100644 (file)
@@ -2,33 +2,30 @@
 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.conf.urls import patterns, url, include
+from django.conf.urls import url, include
+from . import views
 
-from .views import WLFundView, OfferDetailView, OfferListView, ThanksView, NoThanksView, CurrentView, \
-    DisableNotifications
 
+urlpatterns = [
+    url(r'^$', views.CurrentView.as_view(), name='funding_current'),
+    url(r'^teraz/$', views.CurrentView.as_view()),
+    url(r'^teraz/(?P<slug>[^/]+)/$', views.CurrentView.as_view(), name='funding_current'),
+    url(r'^lektura/$', views.OfferListView.as_view(), name='funding'),
+    url(r'^lektura/(?P<slug>[^/]+)/$', views.OfferDetailView.as_view(), name='funding_offer'),
+    url(r'^pozostale/$', views.WLFundView.as_view(), name='funding_wlfund'),
 
-urlpatterns = patterns(
-    'funding.views',
-    url(r'^$', CurrentView.as_view(), name='funding_current'),
-    url(r'^teraz/$', CurrentView.as_view()),
-    url(r'^teraz/(?P<slug>[^/]+)/$', CurrentView.as_view(), name='funding_current'),
-    url(r'^lektura/$', OfferListView.as_view(), name='funding'),
-    url(r'^lektura/(?P<slug>[^/]+)/$', OfferDetailView.as_view(), name='funding_offer'),
-    url(r'^pozostale/$', WLFundView.as_view(), name='funding_wlfund'),
+    url(r'^dziekujemy/$', views.ThanksView.as_view(), name='funding_thanks'),
+    url(r'^niepowodzenie/$', views.NoThanksView.as_view(), name='funding_nothanks'),
 
-    url(r'^dziekujemy/$', ThanksView.as_view(), name='funding_thanks'),
-    url(r'^niepowodzenie/$', NoThanksView.as_view(), name='funding_nothanks'),
-
-    url(r'^wylacz_email/$', DisableNotifications.as_view(), name='funding_disable_notifications'),
+    url(r'^wylacz_email/$', views.DisableNotifications.as_view(), name='funding_disable_notifications'),
 
     url(r'^getpaid/', include('getpaid.urls')),
 
     # Includes
-    url(r'^o/(?P<pk>\d+)/top-bar\.(?P<lang>.+)\.html$', 'top_bar', name='funding_top_bar'),
-    url(r'^o/(?P<pk>\d+)/detail-bar\.(?P<lang>.+)\.html$', 'detail_bar', name='funding_detail_bar'),
-    url(r'^o/(?P<pk>\d+)/list-bar\.(?P<lang>.+)\.html$', 'list_bar', name='funding_list_bar'),
-    url(r'^o/(?P<pk>\d+)/status\.(?P<lang>.+)\.html$', 'offer_status', name='funding_status'),
-    url(r'^o/(?P<pk>\d+)/status-more\.(?P<lang>.+)\.html$', 'offer_status_more', name='funding_status_more'),
-    url(r'^o/(?P<pk>\d+)/fundings/(?P<page>\d+)\.(?P<lang>.+)\.html$', 'offer_fundings', name='funding_fundings'),
-)
+    url(r'^o/(?P<pk>\d+)/top-bar\.(?P<lang>.+)\.html$', views.top_bar, name='funding_top_bar'),
+    url(r'^o/(?P<pk>\d+)/detail-bar\.(?P<lang>.+)\.html$', views.detail_bar, name='funding_detail_bar'),
+    url(r'^o/(?P<pk>\d+)/list-bar\.(?P<lang>.+)\.html$', views.list_bar, name='funding_list_bar'),
+    url(r'^o/(?P<pk>\d+)/status\.(?P<lang>.+)\.html$', views.offer_status, name='funding_status'),
+    url(r'^o/(?P<pk>\d+)/status-more\.(?P<lang>.+)\.html$', views.offer_status_more, name='funding_status_more'),
+    url(r'^o/(?P<pk>\d+)/fundings/(?P<page>\d+)\.(?P<lang>.+)\.html$', views.offer_fundings, name='funding_fundings'),
+]
index 18000c0..74530a4 100644 (file)
@@ -88,7 +88,9 @@ class OfferDetailView(FormView):
                     raise Http404
         return super(OfferDetailView, self).dispatch(request, slug)
 
-    def get_form(self, form_class):
+    def get_form(self, form_class=None):
+        if form_class is None:
+            form_class = self.get_form_class()
         if self.request.method == 'POST':
             return form_class(self.object, self.request.POST)
         else:
index 37025a1..ffae439 100755 (executable)
@@ -2,10 +2,10 @@
 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.conf.urls import patterns, url
+from django.conf.urls import url
+from . import views
 
 
-urlpatterns = patterns(
-    'infopages.views',
-    url(r'^(?P<slug>[a-zA-Z0-9_-]+)/$', 'infopage', name='infopage'),
-)
+urlpatterns = [
+    url(r'^(?P<slug>[a-zA-Z0-9_-]+)/$', views.infopage, name='infopage'),
+]
index 37e363f..2685e83 100644 (file)
@@ -2,13 +2,14 @@
 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.conf.urls import url, patterns
+from django.conf.urls import url
+from . import views
 
-urlpatterns = patterns(
-    'lesmianator.views',
-    url(r'^$', 'main_page', name='lesmianator'),
-    url(r'^wiersz/$', 'new_poem', name='new_poem'),
-    url(r'^lektura/(?P<slug>[a-z0-9-]+)/$', 'poem_from_book', name='poem_from_book'),
-    url(r'^polka/(?P<shelf>[a-zA-Z0-9-]+)/$', 'poem_from_set', name='poem_from_set'),
-    url(r'^wiersz/(?P<poem>[a-zA-Z0-9-]+)/$', 'get_poem', name='get_poem'),
-)
+
+urlpatterns = [
+    url(r'^$', views.main_page, name='lesmianator'),
+    url(r'^wiersz/$', views.new_poem, name='new_poem'),
+    url(r'^lektura/(?P<slug>[a-z0-9-]+)/$', views.poem_from_book, name='poem_from_book'),
+    url(r'^polka/(?P<shelf>[a-zA-Z0-9-]+)/$', views.poem_from_set, name='poem_from_set'),
+    url(r'^wiersz/(?P<poem>[a-zA-Z0-9-]+)/$', views.get_poem, name='get_poem'),
+]
index ae16359..897da15 100644 (file)
@@ -2,12 +2,12 @@
 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.conf.urls import patterns, url
+from django.conf.urls import url
+from . import views
 
 
-urlpatterns = patterns(
-    'libraries.views',
-    url(r'^$', 'main_view', name='libraries_main_view'),
-    url(r'^(?P<slug>[a-zA-Z0-9_-]+)$', 'catalog_view', name='libraries_catalog_view'),
-    url(r'^(?P<catalog_slug>[a-zA-Z0-9_-]+)/(?P<slug>[a-zA-Z0-9_-]+)$', 'library_view', name='libraries_library_view'),
-)
+urlpatterns = [
+    url(r'^$', views.main_view, name='libraries_main_view'),
+    url(r'^(?P<slug>[a-zA-Z0-9_-]+)$', views.catalog_view, name='libraries_catalog_view'),
+    url(r'^(?P<catalog_slug>[a-zA-Z0-9_-]+)/(?P<slug>[a-zA-Z0-9_-]+)$', views.library_view, name='libraries_library_view'),
+]
index 6fbcd42..0eeea8c 100644 (file)
@@ -56,7 +56,6 @@ def nsdcterms(name):
     return '{%s}%s' % (NS_DCTERMS, name)
 
 
-# WTF
 class Catalogue(common.ResumptionOAIPMH):
     TAG_CATEGORIES = ['author', 'epoch', 'kind', 'genre']
 
index 13ea9f1..205d5e6 100644 (file)
@@ -2,7 +2,10 @@
 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.conf.urls import patterns, url
+from django.conf.urls import url
+from . import views
 
-urlpatterns = patterns('oai.views',
-                       url(r'^$', 'oaipmh', name='oaipmh'))
+
+urlpatterns = [
+    url(r'^$', views.oaipmh, name='oaipmh')
+]
index edf9282..8f1059f 100644 (file)
@@ -2,16 +2,15 @@
 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.conf.urls import patterns, url
+from django.conf.urls import url
 from opds.views import RootFeed, ByCategoryFeed, ByTagFeed, UserFeed, UserSetFeed, SearchFeed
 
 
-urlpatterns = patterns(
-    'opds.views',
+urlpatterns = [
     url(r'^$', RootFeed(), name="opds_authors"),
     url(r'^search/$', SearchFeed(), name="opds_search"),
     url(r'^user/$', UserFeed(), name="opds_user"),
     url(r'^set/(?P<slug>[a-zA-Z0-9-]+)/$', UserSetFeed(), name="opds_user_set"),
     url(r'^(?P<category>[a-zA-Z0-9-]+)/$', ByCategoryFeed(), name="opds_by_category"),
     url(r'^(?P<category>[a-zA-Z0-9-]+)/(?P<slug>[a-zA-Z0-9-]+)/$', ByTagFeed(), name="opds_by_tag"),
-)
+]
index e38fd84..a7badbe 100644 (file)
@@ -167,11 +167,15 @@ class PaypalTests(WLTestCase):
         self.client.login(username='test', password='test')
         BillingPlan.objects.create(amount=100)
         response = self.client.get('/paypal/app-return/?token=secret-token')
-        self.assertRedirects(response, 'wolnelekturyapp://paypal_return')
+        self.assertRedirects(
+            response, 'wolnelekturyapp://paypal_return',
+            fetch_redirect_response=False)
 
         # Repeated returns will not generate further agreements.
         response = self.client.get('/paypal/app-return/?token=secret-token')
-        self.assertRedirects(response, 'wolnelekturyapp://paypal_return')
+        self.assertRedirects(
+            response, 'wolnelekturyapp://paypal_return',
+            fetch_redirect_response=False)
         self.assertEqual(BillingAgreement.objects.all().count(), 1)
 
         self.assertTrue(user_is_subscribed(self.user))
@@ -185,7 +189,9 @@ class PaypalTests(WLTestCase):
                 execute=Mock(return_value=Mock(id=None)))):
             self.client.get('/paypal/app-return/?token=secret-token')
             response = self.client.get('/paypal/app-return/?token=secret-token')
-            self.assertRedirects(response, 'wolnelekturyapp://paypal_error')
+            self.assertRedirects(
+                response, 'wolnelekturyapp://paypal_error',
+                fetch_redirect_response=False)
 
         # No agreement created in our DB if not executed successfully.
         self.assertEqual(BillingAgreement.objects.all().count(), 0)
@@ -195,7 +201,9 @@ class PaypalTests(WLTestCase):
                 execute=BillingAgreementMock.execute,
                 find=Mock(side_effect=ResourceNotFound(None)))):
             response = self.client.get('/paypal/app-return/?token=secret-token')
-            self.assertRedirects(response, 'wolnelekturyapp://paypal_return')
+            self.assertRedirects(
+                response, 'wolnelekturyapp://paypal_return',
+                fetch_redirect_response=False)
 
         # Now the agreement exists in our DB, but is not active.
         self.assertEqual([b.active for b in BillingAgreement.objects.all()], [False])
index 643149a..e203257 100644 (file)
@@ -9,7 +9,6 @@ from sorl.thumbnail import ImageField
 from django.conf import settings
 from django.contrib.contenttypes.fields import GenericRelation
 from django.core.files.storage import FileSystemStorage
-from django.utils.datastructures import SortedDict
 from slugify import slugify
 from ssify import flush_ssi_includes
 
@@ -326,33 +325,6 @@ class Picture(models.Model):
         annotated.paste(annotation.resize((img.size[0], 40), Image.ANTIALIAS), (0, img.size[1]))
         return annotated
 
-    # WTF/unused
-    @classmethod
-    def picture_list(cls, filter=None):
-        """Generates a hierarchical listing of all pictures
-        Pictures are optionally filtered with a test function.
-        """
-
-        pics = cls.objects.all().order_by('sort_key').only('title', 'slug', 'image_file')
-
-        if filter:
-            pics = pics.filter(filter).distinct()
-
-        pics_by_author = SortedDict()
-        orphans = []
-        for tag in catalogue.models.Tag.objects.filter(category='author'):
-            pics_by_author[tag] = []
-
-        for pic in pics.iterator():
-            authors = list(pic.authors().only('pk'))
-            if authors:
-                for author in authors:
-                    pics_by_author[author].append(pic)
-            else:
-                orphans.append(pic)
-
-        return pics_by_author, orphans
-
     @property
     def info(self):
         if not hasattr(self, '_info'):
index 6ace134..6f02007 100644 (file)
@@ -10,23 +10,6 @@ from picture.models import Picture, PictureArea
 from catalogue.utils import split_tags
 from ssify import ssi_included
 from sponsors.models import Sponsor
-
-
-# WTF/unused
-# # was picture/picture_list.html list (without thumbs)
-# def picture_list(request, filter=None, get_filter=None, template_name='catalogue/picture_list.html',
-#                  cache_key=None, context=None):
-#     """ generates a listing of all books, optionally filtered with a test function """
-#
-#     if get_filter:
-#         filt = get_filter()
-#     pictures_by_author, orphans = Picture.picture_list(filt)
-#     books_nav = OrderedDict()
-#     for tag in pictures_by_author:
-#         if pictures_by_author[tag]:
-#             books_nav.setdefault(tag.sort_key[0], []).append(tag)
-#
-#     return render_to_response(template_name, locals(), context_instance=RequestContext(request))
 from wolnelektury.utils import ajax
 
 
@@ -45,10 +28,6 @@ def picture_detail(request, slug):
 
     theme_things = split_tags(picture.related_themes())
 
-    # categories = SortedDict()
-    # for tag in picture.tags.iterator():
-    #     categories.setdefault(tag.category, []).append(tag)
-
     return render_to_response("picture/picture_detail.html", {
         'picture': picture,
         'themes': theme_things.get('theme', []),
index 0bec684..8a5f621 100644 (file)
@@ -2,10 +2,10 @@
 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.conf.urls import patterns, url
+from django.conf.urls import url
+from . import views
 
 
-urlpatterns = patterns(
-    'polls.views',
-    url(r'^(?P<slug>[^/]+)$', 'poll', name='poll'),
-)
+urlpatterns = [
+    url(r'^(?P<slug>[^/]+)$', views.poll, name='poll'),
+]
index 70a8487..173b2dd 100644 (file)
@@ -2,11 +2,11 @@
 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.conf.urls import patterns, url
-
+from django.conf.urls import url
 from push import views
 
-urlpatterns = (
+
+urlpatterns = [
     url(r'^wyslij/$', views.notification_form, name='notification_form'),
     url(r'^wyslane/$', views.notification_sent, name='notification_sent'),
-)
+]
index 3b09f11..f4a65f4 100755 (executable)
@@ -2,12 +2,12 @@
 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.conf.urls import patterns, url
+from django.conf.urls import url
+from . import views
 
 
-urlpatterns = patterns(
-    'reporting.views',
-    url(r'^$', 'stats_page', name='reporting_stats'),
-    url(r'^katalog.pdf$', 'catalogue_pdf', name='reporting_catalogue_pdf'),
-    url(r'^katalog.csv$', 'catalogue_csv', name='reporting_catalogue_csv'),
-)
+urlpatterns = [
+    url(r'^$', views.stats_page, name='reporting_stats'),
+    url(r'^katalog.pdf$', views.catalogue_pdf, name='reporting_catalogue_pdf'),
+    url(r'^katalog.csv$', views.catalogue_csv, name='reporting_catalogue_csv'),
+]
index 5a59422..46914d6 100644 (file)
@@ -2,10 +2,11 @@
 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.conf.urls import patterns, url
+from django.conf.urls import url
+from . import views
 
-urlpatterns = patterns(
-    'search.views',
-    url(r'^$', 'main', name='wlsearch'),
-    url(r'^hint/$', 'hint', name='search_hint'),
-)
+
+urlpatterns = [
+    url(r'^$', views.main, name='wlsearch'),
+    url(r'^hint/$', views.hint, name='search_hint'),
+]
index f9222ce..395e54a 100755 (executable)
@@ -2,26 +2,19 @@
 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.conf.urls import patterns, url
+from django.conf.urls import url
 from django.views.decorators.cache import never_cache
-from social.views import ObjectSetsFormView
+from . import views
 
-urlpatterns = patterns(
-    'social.views',
-    url(r'^lektura/(?P<slug>[a-z0-9-]+)/lubie/$', 'like_book', name='social_like_book'),
-    url(r'^lektura/(?P<slug>[a-z0-9-]+)/nie_lubie/$', 'unlike_book', name='social_unlike_book'),
-    url(r'^lektura/(?P<slug>[a-z0-9-]+)/polki/$', never_cache(ObjectSetsFormView()), name='social_book_sets'),
-    url(r'^polka/$', 'my_shelf', name='social_my_shelf'),
 
-    # Includes
-    url(r'^cite/(?P<pk>\d+)\.(?P<lang>.+)\.html$', 'cite', name='social_cite'),
-    url(r'^cite_main/(?P<pk>\d+)\.(?P<lang>.+)\.html$', 'cite', {'main': True}, name='social_cite_main'),
-    url(r'^cite_info/(?P<pk>\d+).html$', 'cite_info', name='social_cite_info'),
+urlpatterns = [
+    url(r'^lektura/(?P<slug>[a-z0-9-]+)/lubie/$', views.like_book, name='social_like_book'),
+    url(r'^lektura/(?P<slug>[a-z0-9-]+)/nie_lubie/$', views.unlike_book, name='social_unlike_book'),
+    url(r'^lektura/(?P<slug>[a-z0-9-]+)/polki/$', never_cache(views.ObjectSetsFormView()), name='social_book_sets'),
+    url(r'^polka/$', views.my_shelf, name='social_my_shelf'),
 
-    # url(r'^polki/(?P<shelf>[a-zA-Z0-9-]+)/formaty/$', 'shelf_book_formats', name='shelf_book_formats'),
-    # url(r'^polki/(?P<shelf>[a-zA-Z0-9-]+)/(?P<slug>%s)/usun$' % SLUG, 'remove_from_shelf', name='remove_from_shelf'),
-    # url(r'^polki/$', 'user_shelves', name='user_shelves'),
-    # url(r'^polki/(?P<slug>[a-zA-Z0-9-]+)/usun/$', 'delete_shelf', name='delete_shelf'),
-    # url(r'^polki/(?P<slug>[a-zA-Z0-9-]+)\.zip$', 'download_shelf', name='download_shelf'),
-    # url(r'^polki/nowa/$', 'new_set', name='new_set'),
-)
+    # Includes
+    url(r'^cite/(?P<pk>\d+)\.(?P<lang>.+)\.html$', views.cite, name='social_cite'),
+    url(r'^cite_main/(?P<pk>\d+)\.(?P<lang>.+)\.html$', views.cite, {'main': True}, name='social_cite_main'),
+    url(r'^cite_info/(?P<pk>\d+).html$', views.cite_info, name='social_cite_info'),
+]
index 7c6bc2c..fe38986 100644 (file)
@@ -2,9 +2,10 @@
 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.conf.urls import patterns, url
+from django.conf.urls import url
+from . import views
 
-urlpatterns = patterns(
-    'sponsors.views',
-    url(r'^page/(?P<name>.+)\.html$', 'page', name='sponsor_page'),
-)
+
+urlpatterns = [
+    url(r'^page/(?P<name>.+)\.html$', views.page, name='sponsor_page'),
+]
index 5e721d4..167a1a8 100644 (file)
@@ -2,11 +2,10 @@
 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.conf.urls import patterns, url
+from django.conf.urls import url
 from suggest import views
 
-urlpatterns = patterns(
-    '',
+urlpatterns = [
     url(r'^$', views.SuggestionFormView(), name='suggest'),
     url(r'^plan/$', views.PublishingSuggestionFormView(), name='suggest_publishing'),
-)
+]
index 69ab03a..51d5f6e 100644 (file)
@@ -2,9 +2,9 @@
 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.conf.urls import patterns, url
+from django.conf.urls import url
+from waiter import views
 
-urlpatterns = patterns(
-    'waiter.views',
-    url(r'^(?P<path>.*)$', 'wait', name='waiter'),
-)
+urlpatterns = [
+    url(r'^(?P<path>.*)$', views.wait, name='waiter'),
+]
index 2c76f67..c98944b 100644 (file)
@@ -68,7 +68,6 @@ INSTALLED_APPS_CONTRIB = [
     'django_gravatar',
 
     # allauth stuff
-    'uni_form',
     'allauth',
     'allauth.account',
     'allauth.socialaccount',
index 7990f25..ebadbb8 100644 (file)
@@ -49,10 +49,10 @@ TEMPLATES = [{
         ),
         'context_processors': (
             'django.contrib.auth.context_processors.auth',
-            'django.core.context_processors.debug',
-            'django.core.context_processors.i18n',
-            'django.core.context_processors.media',
-            'django.core.context_processors.request',
+            'django.template.context_processors.debug',
+            'django.template.context_processors.i18n',
+            'django.template.context_processors.media',
+            'django.template.context_processors.request',
             'wolnelektury.context_processors.extra_settings',
             'search.context_processors.search_form',
         ),
index 3c1997d..146e35b 100644 (file)
@@ -33,9 +33,6 @@ PIPELINE = {
 
                 'css/annoy.css',
 
-                'uni_form/uni-form.css',
-                'uni_form/default.uni-form.css',
-
                 'css/ui-lightness/jquery-ui-1.8.16.custom.css',
 
                 'css/tlite.css',
@@ -112,8 +109,6 @@ PIPELINE = {
                 'js/search.js',
                 'funding/funding.js',
 
-                'uni_form/uni-form.js',
-
                 'js/annoy.js',
                 ),
             'output_filename': 'js/base.min.js',
index f5feb4e..12a6565 100644 (file)
@@ -68,7 +68,7 @@
                 </span>
                 <div id="lang-menu-items">
                   {% for lang in LANGUAGES %}
-                    <form action="{% url 'django.views.i18n.set_language' %}" method="post">
+                    <form action="{% url 'set_language' %}" method="post">
                       {% ssi_csrf_token %}
                       <input type="hidden" name="language" value="{{ lang.0 }}"/>
                       <button type="submit" lang="{{ lang.0 }}"
index f9b4b34..c98d7c7 100644 (file)
@@ -1,27 +1,19 @@
 {% extends "site_base.html" %}
 
 {% load i18n %}
-{% load uni_form_tags %}
 
 {% block head_title %}{% trans "OpenID Sign In" %}{% endblock %}
 
 {% block body %}
   <h1>{% trans 'OpenID Sign In' %}</h1>
   <div class="normal-text white-box">
-    <form id="openid_login_form" class="openid_login uniForm" method="post" action="{% url 'openid_login' %}">
+    <form id="openid_login_form" class="openid_login" method="post" action="{% url 'openid_login' %}">
       {% csrf_token %}
-      <fieldset class="inlineLabels">
-        {#{form|as_uni_form}#}
-        <div id="div_id_openid" class="ctrlHolder">
-          <label for="id_openid" class="requiredField">
-            OpenID<span class="asteriskField">*</span>
-          </label>
-          <input id="id_openid" type="text" class="textInput textinput" name="openid" />
-        </div>
-        <div class="buttonHolder">
+          <label for="id_openid">
+            OpenID:
+         </label><br>
+         <input id="id_openid" type="text" class="textinput" name="openid" /><br><br>
           <button type="submit">{% trans "Sign In" %}</button>
-        </div>
-      </fieldset>
     </form>
   </div>
 {% endblock %}
index 0f10724..6810386 100644 (file)
 <p>{% blocktrans %}You can sign in to your account using any of the following third party accounts:{% endblocktrans %}</p>
 
 
-<form class="uniForm" method="post">
+<form method="post">
 {% csrf_token %}
 
-<fieldset class="blockLabels">
 {% if form.non_field_errors %}
-<div id="errorMsg">{{form.non_field_errors}}</div>
+<div>{{form.non_field_errors}}</div>
 {% endif %}
 
 {% for base_account in form.accounts %}
 {% with base_account.get_provider_account as account %}
-<div class="ctrlHolder">
 <label for="id_account_{{base_account.id}}">
 <input id="id_account_{{base_account.id}}" type="radio" name="account" value="{{base_account.id}}"/>
 <span class="socialaccount_provider {{base_account.provider}} {{account.get_brand.id}}">{{account.get_brand.name}}</span>
 <small>{{account}}</small>
-</label>
-</div>
+</label><br><br>
 {% endwith %}
 {% endfor %}
 
-<div class="buttonHolder">
 <button type="submit">{% trans "Remove" %}</button>
-</div>
 
-</fieldset>
 
 </form>