Django 1.8
authorRadek Czajka <rczajka@rczajka.pl>
Tue, 1 Oct 2019 11:03:16 +0000 (13:03 +0200)
committerRadek Czajka <rczajka@rczajka.pl>
Tue, 1 Oct 2019 11:03:16 +0000 (13:03 +0200)
23 files changed:
events/templates/events/event_list.html
events/templates/events/snippets/events_box.html
events/templatetags/events_tags.py
events/urls.py
prawokultury/settings.d/20-basic.py
prawokultury/settings.d/30-apps.py
prawokultury/settings.d/40-context.py [deleted file]
prawokultury/settings.d/40-middleware.py
prawokultury/settings.d/50-contrib.py
prawokultury/settings.d/50-static.py
prawokultury/templates/base.html
prawokultury/templates/migdal/entry/publications/entry_detail.html
prawokultury/urls.py
questions/templates/questions/question_detail.html
questions/templates/questions/question_form.html
questions/templates/questions/question_list.html
questions/templates/questions/question_thanks.html
questions/urls.py
requirements.txt
shop/templates/shop/email/payed_managers.txt
shop/templates/shop/snippets/order_form.html
shop/urls.py
shop/views.py

index ad2a92c..af71653 100755 (executable)
@@ -1,5 +1,4 @@
 {% extends "base.html" %}
-{% load url from future %}
 {% load i18n pagination_tags fnp_prevnext %}
 {% load events_tags %}
 
index 16de000..eb7693c 100755 (executable)
@@ -1,5 +1,4 @@
 {% load i18n %}
-{% load url from future %}
 
 <ul class="event-list">
 {% for event in objects %}
index ea2734d..3bd5135 100644 (file)
@@ -3,6 +3,7 @@
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
 from django import template
+from django.utils.timezone import now
 from events import app_settings
 from events.models import Event
 
@@ -14,7 +15,7 @@ from datetime import datetime
 def events_box(context, limit=app_settings.BOX_LENGTH):
     lang = context['request'].LANGUAGE_CODE
     objects = Event.objects.filter(**{"published_%s" % lang: True})
-    objects = objects.filter(date_end__gte=datetime.now())[:limit]
+    objects = objects.filter(date_end__gte=now())[:limit]
     return {'objects': objects}
 
 
index ebec896..175cba7 100644 (file)
@@ -2,11 +2,12 @@
 # This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later.
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
-from django.conf.urls import patterns, include, url
+from django.conf.urls import include, url
 from django.utils.translation import string_concat, ugettext_lazy as _
+from . import views
 
 
-urlpatterns = patterns('events.views',
-    url(r'^$', 'events', name='events'),
-    url(string_concat('^', _('past'), '/$'), 'events_past', name='events_past'),
-)
+urlpatterns = [
+    url(r'^$', views.events, name='events'),
+    url(string_concat('^', _('past'), '/$'), views.events_past, name='events_past'),
+]
index 0d126cc..d483b31 100644 (file)
@@ -1,5 +1,4 @@
 DEBUG = False
-TEMPLATE_DEBUG = DEBUG
 
 DATABASES = {
     'default': {
@@ -14,20 +13,26 @@ DATABASES = {
 
 SITE_ID = 1
 
-# List of callables that know how to import templates from various sources.
-TEMPLATE_LOADERS = (
-    'django.template.loaders.filesystem.Loader',
-    'django.template.loaders.app_directories.Loader',
-#     'django.template.loaders.eggs.Loader',
-)
+
+TEMPLATES = [{
+    'BACKEND': 'django.template.backends.django.DjangoTemplates',
+    'APP_DIRS': True,
+    'OPTIONS': {
+        'context_processors': (
+            "django.contrib.auth.context_processors.auth",
+            "django.template.context_processors.debug",
+            "django.template.context_processors.i18n",
+            "django.template.context_processors.media",
+            "django.template.context_processors.static",
+            "django.template.context_processors.tz",
+            "django.contrib.messages.context_processors.messages",
+            'django.template.context_processors.request',
+        ),
+    },
+}]
 
 ROOT_URLCONF = 'prawokultury.urls'
 
 # Python dotted path to the WSGI application used by Django's runserver.
 WSGI_APPLICATION = 'prawokultury.wsgi.application'
 
-TEMPLATE_DIRS = (
-    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
-    # Always use forward slashes, even on Windows.
-    # Don't forget to use absolute paths, not relative paths.
-)
index 458031b..e5c0f00 100644 (file)
@@ -13,7 +13,7 @@ INSTALLED_APPS = (
     'django_comments_xtd',
     'pipeline',
     'haystack',
-    'pagination',
+    'fnp_django_pagination',
     'sorl.thumbnail',
     'piwik',
     'django_cas_ng',
diff --git a/prawokultury/settings.d/40-context.py b/prawokultury/settings.d/40-context.py
deleted file mode 100644 (file)
index fe0dd19..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-TEMPLATE_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.static",
-    "django.core.context_processors.tz",
-    "django.contrib.messages.context_processors.messages",
-    'django.core.context_processors.request',
-)
index b48e178..859509e 100644 (file)
@@ -8,18 +8,12 @@ MIDDLEWARE_CLASSES = (
     'prawokultury.middleware.ExemptableHoneypotViewMiddleware',
     'honeypot.middleware.HoneypotResponseMiddleware',
     'django.contrib.auth.middleware.AuthenticationMiddleware',
-)
-
-if 'django_cas' in INSTALLED_APPS:
-    MIDDLEWARE_CLASSES += (
-        'django_cas_ng.middleware.CASMiddleware',
-    )
-
-MIDDLEWARE_CLASSES += (
+    'django.contrib.auth.middleware.SessionAuthenticationMiddleware',
+    'django_cas_ng.middleware.CASMiddleware',
     'django.contrib.messages.middleware.MessageMiddleware',
     # Uncomment the next line for simple clickjacking protection:
     # 'django.middleware.clickjacking.XFrameOptionsMiddleware',
-    'pagination.middleware.PaginationMiddleware',
+    'fnp_django_pagination.middleware.PaginationMiddleware',
     'fnpdjango.middleware.SetRemoteAddrFromXRealIP',
 )
 
index 96107be..2481aa9 100644 (file)
@@ -26,6 +26,7 @@ TAGGIT_AUTOSUGGEST_MODEL = ('questions', 'Tag')
 GETPAID_BACKENDS = (
     'getpaid.backends.payu',
 )
+GETPAID_ORDER_MODEL = 'shop.Order'
 
 PIWIK_URL = ''
 PIWIK_SITE_ID = 0
index 031658c..292c3a9 100644 (file)
@@ -6,57 +6,57 @@ STATIC_URL = '/static/'
 STATICFILES_FINDERS = (
     'django.contrib.staticfiles.finders.FileSystemFinder',
     'django.contrib.staticfiles.finders.AppDirectoriesFinder',
-#    'django.contrib.staticfiles.finders.DefaultStorageFinder',
+    'pipeline.finders.PipelineFinder',
 )
 
 STATICFILES_STORAGE = 'fnpdjango.pipeline_storage.GzipPipelineCachedStorage'
-PIPELINE_CSS_COMPRESSOR = None
-PIPELINE_JS_COMPRESSOR = None
-PIPELINE_CSS = {
-    'base': {
-        'source_filenames': (
-          'css/base.scss',
-          'css/layout.scss',
-          'css/header.scss',
-          'css/menu.scss',
-          'css/search.scss',
-          'css/sidebar.scss',
-          'css/promobox.scss',
-          'css/entry.scss',
-          'css/footer.scss',
-          'css/prevnext.scss',
-          'css/forms.scss',
-          'events/events.scss',
-          'fnpdjango/annoy/annoy.css',
-        ),
-        'output_filename': 'compressed/base.css',
-    },
-    'questions': {
-        'source_filenames': (
-            'questions/tagcloud.scss',
-        ),
-        'output_filename': 'compressed/questions.css'
-    }
-}
-PIPELINE_JS = {
-    'base': {
-        'source_filenames': (
-            'js/promobox.js',
-            'shop/shop.js',
-            'fnpdjango/annoy/annoy.js',
-        ),
-        'output_filename': 'compressed/base.js',
+
+PIPELINE = {
+    'CSS_COMPRESSOR': None,
+    'JS_COMPRESSOR': None,
+    'COMPILERS': [
+        'pipeline.compilers.sass.SASSCompiler',
+    ],
+    'STYLESHEETS': {
+        'base': {
+            'source_filenames': (
+                'css/base.scss',
+                'css/layout.scss',
+                'css/header.scss',
+                'css/menu.scss',
+                'css/search.scss',
+                'css/sidebar.scss',
+                'css/promobox.scss',
+                'css/entry.scss',
+                'css/footer.scss',
+                'css/prevnext.scss',
+                'css/forms.scss',
+                'events/events.scss',
+                'fnpdjango/annoy/annoy.css',
+            ),
+            'output_filename': 'compressed/base.css',
+        },
+        'questions': {
+            'source_filenames': (
+                'questions/tagcloud.scss',
+            ),
+            'output_filename': 'compressed/questions.css'
+        }
     },
-    'questions': {
-        'source_filenames': (
-            'questions/tagcloud.js',
-        ),
-        'output_filename': 'compressed/questions.js'
+    'JAVASCRIPT': {
+        'base': {
+            'source_filenames': (
+                'js/promobox.js',
+                'shop/shop.js',
+                'fnpdjango/annoy/annoy.js',
+            ),
+            'output_filename': 'compressed/base.js',
+        },
+        'questions': {
+            'source_filenames': (
+                'questions/tagcloud.js',
+            ),
+            'output_filename': 'compressed/questions.js'
+        }
     }
 }
-
-PIPELINE_COMPILERS = (
-  'pipeline.compilers.sass.SASSCompiler',
-)
-
-PIPELINE_STORAGE = 'pipeline.storage.PipelineFinderStorage'
index 6d516b5..d2615be 100644 (file)
@@ -1,16 +1,15 @@
 <!DOCTYPE html>
-{% load url from future %}
 {% load i18n %}
 {% load static from staticfiles %}
 {% load fnp_common menu_tags migdal_tags events_tags fnp_share fnp_lang %}
-{% load compressed %}
+{% load pipeline %}
 {% load chunks %}
 {% load piwik_tags %}
 <html prefix="og: http://ogp.me/ns#">
     <head>
        <title>{% block titleextra %}{% endblock %}{% trans "Right to Culture" %}</title>
        <link rel="shortcut icon" type="image/png" href="{% static "img/favicon.png" %}" />
-        {% compressed_css 'base' %}
+        {% stylesheet 'base' %}
         {% block extra_css %}{% endblock %}
         <meta charset="UTF-8" />
         <meta property='og:url' content='{% block ogurl %}{{ request.get_full_path|build_absolute_uri:request }}{% endblock %}' />
 
     </div>
     <script type="text/javascript" src="//code.jquery.com/jquery-1.8.0.min.js" charset="utf-8"></script>
-    {% compressed_js 'base' %}
+    {% javascript 'base' %}
     {% tracking_code %}
     {% block extra_js %}{% endblock %}
     </body>
index 5b6fc73..5ddfbcb 100755 (executable)
@@ -1,7 +1,6 @@
 {% extends "base.html" %}
 {% load comments i18n %}
 {% load fnp_common migdal_tags fnp_share shop_tags %}
-{% load url from future %}
 
 
 {% block body %}
index 07b89c2..730b768 100644 (file)
@@ -3,45 +3,35 @@
 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
 #
 from django.conf import settings
-from django.conf.urls import patterns, include, url
+from django.conf.urls import include, url
 from django.contrib import admin
+import django.contrib.sitemaps.views
 from django.contrib.staticfiles.urls import staticfiles_urlpatterns
 from django.utils.translation import ugettext_lazy as _, string_concat
+import django_cas_ng.views
 from fnpdjango.utils.urls import i18n_patterns
 from events.urls import urlpatterns as events_urlpatterns
 from migdal.urls import urlpatterns as migdal_urlpatterns
+from migdal.sitemap import sitemaps as migdal_sitemaps
+from questions.sitemap import sitemaps as question_sitemaps
 
 admin.autodiscover()
 
-urlpatterns = patterns('',
-    url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
-            'document_root': settings.MEDIA_ROOT,
-        }),
+urlpatterns = [
     url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')),
-    )
-
-if 'django.contrib.sitemaps' in settings.INSTALLED_APPS:
-    from migdal.sitemap import sitemaps as migdal_sitemaps
-    from questions.sitemap import sitemaps as question_sitemaps
-    sitemaps = dict(migdal_sitemaps.items() + question_sitemaps.items())
-    urlpatterns += patterns('',
-        url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {
-            'sitemaps': sitemaps
-        }),
-    )
 
-if 'django_cas_ng' in settings.INSTALLED_APPS:
-    urlpatterns += patterns('',
-        (r'^accounts/login/$', 'django_cas_ng.views.login'),
-        (r'^accounts/logout/$', 'django_cas_ng.views.logout'),
-        (r'^admin/login/$', 'django_cas_ng.views.login'),
-        (r'^admin/logout/$', 'django_cas_ng.views.logout'),
-    )
+    url(r'^sitemap\.xml$', django.contrib.sitemaps.views.sitemap, {
+        'sitemaps': dict(migdal_sitemaps.items() + question_sitemaps.items())
+    }),
+
+    url(r'^accounts/login/$', django_cas_ng.views.login),
+    url(r'^accounts/logout/$', django_cas_ng.views.logout),
+    url(r'^admin/login/$', django_cas_ng.views.login),
+    url(r'^admin/logout/$', django_cas_ng.views.logout),
 
-urlpatterns += patterns('',
     url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
     url(r'^admin/', include(admin.site.urls)),
-)
+]
 
 urlpatterns += i18n_patterns(
     url(string_concat(r'^', _('events'), r'/'), include('events.urls')),
@@ -51,10 +41,11 @@ urlpatterns += i18n_patterns(
 ) + migdal_urlpatterns 
 
 if settings.DEBUG:
-    urlpatterns += patterns('',
-        url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {
+    import django.views.static
+    urlpatterns += [
+        url(r'^media/(?P<path>.*)$', django.views.static.serve, {
             'document_root': settings.MEDIA_ROOT,
         }),
-   )
+   ]
 
 urlpatterns += staticfiles_urlpatterns()
index e0e3e9e..b8770bd 100755 (executable)
@@ -1,5 +1,4 @@
 {% extends "base.html" %}
-{% load url from future %}
 
 {% block titleextra %}{{ question|linebreaksbr }} :: {% endblock %}
 {% block body %}
index 751b0b8..3e34d07 100755 (executable)
@@ -1,5 +1,4 @@
 {% extends "base.html" %}
-{% load url from future %}
 {% load chunks %}
 
 {% block titleextra %}Pierwsza pomoc w prawie autorskim: pytanie do prawnika :: {% endblock %}
index 8ef2773..7714b21 100755 (executable)
@@ -1,7 +1,6 @@
 {% extends "base.html" %}
-{% load url from future %}
 {% load pagination_tags fnp_prevnext %}
-{% load compressed %}
+{% load pipeline %}
 {% load chunks %}
 
 {% block titleextra %}Pierwsza pomoc w prawie autorskim :: {% endblock %}
@@ -61,9 +60,9 @@
 {% endblock %}
 
 {% block extra_css %}
-    {% compressed_css 'questions' %}
+    {% stylesheet 'questions' %}
 {% endblock %}
 
 {% block extra_js %}
-    {% compressed_js 'questions' %}
+    {% javascript 'questions' %}
 {% endblock %}
index a5dc200..8cde603 100755 (executable)
@@ -1,5 +1,4 @@
 {% extends "base.html" %}
-{% load url from future %}
 
 {% block titleextra %}Dziękujemy za przesłanie pytania :: {% endblock %}
 {% block body %}
@@ -11,4 +10,4 @@
 <p>Wróć do <a href="{% url 'migdal_main' %}">strony głównej</a>.</p>
 
 </div>
-{% endblock %}
\ No newline at end of file
+{% endblock %}
index 3073290..ca1ec8a 100755 (executable)
@@ -2,12 +2,12 @@
 # This file is part of PrawoKultury, 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.generic import DetailView, TemplateView
 from .models import Question
 from .views import QuestionFormView, QuestionListView
 
-urlpatterns = patterns('',
+urlpatterns = [
     url(r'^$',
         QuestionListView.as_view(),
         name="questions"
@@ -25,4 +25,4 @@ urlpatterns = patterns('',
         ),
         name="questions_thanks"
     ),
-)
+]
index 76422f1..3a963c2 100644 (file)
@@ -1,9 +1,9 @@
 -i https://py.mdrn.pl/simple
 
-Django>=1.7,<1.8
+Django>=1.8,<1.9
 Pillow
 sorl-thumbnail==12.4.1
-django-pagination
+fnp-django-pagination==2.2.4
 django-honeypot==0.4.0
 django-cas-ng==3.5.10
 
@@ -15,7 +15,7 @@ django-markupfield==1.4.3
 django-gravatar2
 django-contrib-comments==1.6.0
 django-comments-xtd==1.5.1
-django-pipeline>=1.3.23,<1.4
+django-pipeline==1.6.14
 
 #pyScss
 #git+git://github.com/Kronuz/pyScss.git@d8f4da23a3c87696a75b3830ed4ab49b75550a93#egg=pyScss
@@ -25,9 +25,9 @@ django-haystack==2.7.0
 pysolr
 django-piwik
 
-django-taggit>=0.12,<0.13
-django-taggit-autosuggest>=0.2.1,<0.3
+django-taggit==0.22.2
+django-taggit-autosuggest>=0.3.8
 
-django-getpaid>=1.6,<1.7
+django-getpaid==1.7.6
 django-celery>=3.1,<3.2
 celery<4.0
index 748d4d9..3298c94 100755 (executable)
@@ -1,6 +1,5 @@
 {% extends "shop/email/base.txt" %}
 {% load i18n %}
-{% load url from future %}
 
 
 {% block body %}
index a1f00e9..3789fa6 100755 (executable)
@@ -1,5 +1,4 @@
 {% load i18n staticfiles %}
-{% load url from future %}
 
 <form class="submit-form" action="{% url 'shop_buy' form.offer.entry.slug %}" method="post">
     <table>
index debea33..cb480d0 100644 (file)
@@ -2,7 +2,7 @@
 # This file is part of PrawoKultury, 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 django.utils.translation import ugettext_lazy as _
 from django.views.decorators.csrf import csrf_exempt
 from getpaid.backends.payu.views import OnlineView
@@ -10,7 +10,7 @@ from prawokultury.middleware import honeypot_exempt
 from .views import ThanksView, NoThanksView, OfferDetailView
 
 
-urlpatterns = patterns('',
+urlpatterns = [
     url(r'^kup/(?P<slug>[^/]+)/$', OfferDetailView.as_view(), name='shop_buy'),
     url(r'^dziekujemy/(?P<pk>\d+)/$', ThanksView.as_view(), name='shop_thanks'),
     url(r'^niepowodzenie/(?P<pk>\d+)/$', NoThanksView.as_view(), name='shop_nothanks'),
@@ -18,4 +18,4 @@ urlpatterns = patterns('',
             honeypot_exempt(csrf_exempt(OnlineView.as_view())),
             name='getpaid-payu-online'),
     url(r'^getpaid/', include('getpaid.urls')),
-)
+]
index ef73d66..7c70f20 100644 (file)
@@ -38,7 +38,7 @@ class OfferDetailView(FormView):
         ctx['entry'] = self.object.entry
         return ctx
 
-    def get_form(self, form_class):
+    def get_form(self, form_class=OrderForm):
         return form_class(self.object, self.request.POST)
 
     def form_valid(self, form):