From: Radek Czajka Date: Wed, 7 Aug 2019 09:00:23 +0000 (+0200) Subject: Upgrade do Django 2.1, Machina 1; remove obsolete settings from banners. X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/ff928e937ca4498faa2b51e9ee818499fbcc8eaf Upgrade do Django 2.1, Machina 1; remove obsolete settings from banners. --- diff --git a/requirements/requirements.txt b/requirements/requirements.txt index 5081a1d99..1cff065bb 100644 --- a/requirements/requirements.txt +++ b/requirements/requirements.txt @@ -1,7 +1,7 @@ -i https://py.mdrn.pl/simple/ # django -Django==2.0.13 +Django==2.1.11 fnpdjango==0.4 django-pipeline==1.6.13 jsmin @@ -14,7 +14,7 @@ django-extensions==2.2.1 djangorestframework==3.9.4 djangorestframework-xml django-admin-ordering==0.10.0 -django-machina==0.7.1 +django-machina==1.0.2 oauthlib>=3.0.1,<3.1 diff --git a/src/social/admin.py b/src/social/admin.py index 01e60fa91..6e5bf3ab5 100644 --- a/src/social/admin.py +++ b/src/social/admin.py @@ -22,7 +22,7 @@ class CiteAdmin(admin.ModelAdmin): list_display = ['nonempty_text', 'created_at', 'sticky', 'vip', 'small', 'has_image'] list_filter = ['group'] readonly_fields = ['created_at'] - raw_id_fields = ['book'] + autocomplete_fields = ['book'] fieldsets = ( (None, {'fields': ('group', 'sticky', 'created_at', 'book')}), (_('Content'), {'fields': ('link', 'vip', 'text', 'small')}), @@ -31,15 +31,12 @@ class CiteAdmin(admin.ModelAdmin): 'picture', 'picture_alt', 'picture_title', 'picture_author', 'picture_link', 'picture_license', 'picture_license_link' - - #'banner', )}), ( _('Background'), {'fields': ( ('background_plain', 'background_color'), - 'image', 'image_shift', - 'banner', + 'image', 'image_title', 'image_author', 'image_link', 'image_license', 'image_license_link' )}, diff --git a/src/social/locale/pl/LC_MESSAGES/django.mo b/src/social/locale/pl/LC_MESSAGES/django.mo index c470ca1e5..e0abbc65c 100644 Binary files a/src/social/locale/pl/LC_MESSAGES/django.mo and b/src/social/locale/pl/LC_MESSAGES/django.mo differ diff --git a/src/social/locale/pl/LC_MESSAGES/django.po b/src/social/locale/pl/LC_MESSAGES/django.po index d65d69190..5b6610d20 100644 --- a/src/social/locale/pl/LC_MESSAGES/django.po +++ b/src/social/locale/pl/LC_MESSAGES/django.po @@ -5,172 +5,201 @@ # msgid "" msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" +"Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-03-18 13:48+0100\n" -"PO-Revision-Date: 2014-01-24 10:06+0100\n" +"POT-Creation-Date: 2019-08-06 23:20+0200\n" +"PO-Revision-Date: 2019-08-06 23:24+0200\n" "Last-Translator: Radek Czajka \n" -"Language-Team: LANGUAGE \n" -"Language: \n" +"Language: pl\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 " "|| n%100>=20) ? 1 : 2);\n" -"X-Generator: Poedit 1.5.4\n" +"X-Generator: Poedit 2.0.6\n" +"Language-Team: \n" -#: admin.py:16 +#: admin.py:28 msgid "Content" msgstr "Zawartość" -#: admin.py:18 +#: admin.py:29 +msgid "Media box" +msgstr "" + +#: admin.py:36 msgid "Background" msgstr "Obraz tła" -#: admin.py:29 models.py:32 +#: admin.py:50 models.py:40 msgid "text" msgstr "tekst" -#: admin.py:33 models.py:44 +#: admin.py:54 msgid "image" msgstr "obraz" -#: forms.py:22 +#: forms.py:21 msgid "Tags (comma-separated)" msgstr "Tagi (rozdzielone przecinkami)" -#: forms.py:45 +#: forms.py:44 msgid "Name of the new shelf" msgstr "Nazwa nowej półki" -#: models.py:14 +#: models.py:15 msgid "name" -msgstr "" +msgstr "nazwa" -#: models.py:15 models.py:55 +#: models.py:16 models.py:67 msgid "created at" msgstr "utworzone" -#: models.py:19 models.py:101 +#: models.py:20 models.py:140 msgid "banner group" msgstr "grupa bannerów" -#: models.py:20 +#: models.py:21 msgid "banner groups" msgstr "grupy bannerów" -#: models.py:31 +#: models.py:39 msgid "book" msgstr "książka" -#: models.py:33 +#: models.py:41 msgid "small" msgstr "mały" -#: models.py:33 +#: models.py:41 msgid "Make this cite display smaller." msgstr "Sprawia, że cytat wyświetla się mniejszym fontem." -#: models.py:34 +#: models.py:42 msgid "VIP" msgstr "VIP" -#: models.py:35 models.py:51 +#: models.py:43 msgid "link" msgstr "odnośnik" -#: models.py:36 +#: models.py:44 msgid "video" msgstr "wideo" -#: models.py:37 +#: models.py:45 msgid "picture" msgstr "ilustracja" -#: models.py:39 +#: models.py:47 +msgid "picture alternative text" +msgstr "alternatywny tekst ilustracji" + +#: models.py:48 +msgid "picture title" +msgstr "tytuł ilustracji" + +#: models.py:49 +msgid "picture author" +msgstr "autor ilustracji" + +#: models.py:50 +msgid "picture link" +msgstr "link ilustracji" + +#: models.py:51 +msgid "picture license name" +msgstr "nazwa licencji ilustracji" + +#: models.py:52 +msgid "picture license link" +msgstr "adres licencji ilustracji" + +#: models.py:54 msgid "sticky" msgstr "przyklejony" -#: models.py:40 +#: models.py:55 msgid "Sticky cites will take precedense." msgstr "Przyklejone cytaty mają pierwszeństwo." -#: models.py:41 models.py:60 models.py:100 -msgid "banner" -msgstr "banner" +#: models.py:56 +msgid "plain background" +msgstr "jednobarwne tło" -#: models.py:41 -msgid "Adjust size to image, ignore the text" -msgstr "Dostosuj wielkość do obrazu tła, zignoruj tekst." +#: models.py:57 +msgid "background color" +msgstr "kolor tła" -#: models.py:45 -msgid "Best image is exactly 975px wide and weights under 100kB." -msgstr "Najlepszy obraz ma szerokość 975px i waży poniżej 100kB." +#: models.py:59 +msgid "background image" +msgstr "obraz tła" -#: models.py:47 -msgid "shift" -msgstr "przesunięcie" +#: models.py:60 +msgid "Best background is 975 x 315 px and under 100kB." +msgstr "Najlepsze tło ma wielkość 975 x 315 px i waży poniżej 100kB." -#: models.py:48 -msgid "" -"Vertical shift, in percents. 0 means top, 100 is bottom. Default is 50%." -msgstr "" -"Przesunięcie w pionie, w procentach. 0 to wyrównanie do górnej krawędzi, 100 " -"do dolnej. Domyślne jest 50%." +#: models.py:61 +msgid "background title" +msgstr "tytuł obrazu tła" -#: models.py:49 -msgid "title" -msgstr "tytuł" +#: models.py:62 +msgid "background author" +msgstr "autor obrazu tła" -#: models.py:50 -msgid "author" -msgstr "autor" +#: models.py:63 +msgid "background link" +msgstr "link obrazu tła" -#: models.py:52 -msgid "license name" -msgstr "nazwa licencji" +#: models.py:64 +msgid "background license name" +msgstr "nazwa licencji obrazu tła" -#: models.py:53 -msgid "license link" -msgstr "adres licencji" +#: models.py:65 +msgid "background license link" +msgstr "adres licencji obrazu tła" -#: models.py:56 +#: models.py:68 msgid "group" msgstr "grupa" -#: models.py:61 +#: models.py:72 models.py:139 +msgid "banner" +msgstr "banner" + +#: models.py:73 msgid "banners" msgstr "bannery" -#: models.py:87 +#: models.py:126 msgid "slug" msgstr "slug" -#: models.py:91 models.py:99 +#: models.py:130 models.py:138 msgid "carousel" msgstr "karuzela" -#: models.py:92 +#: models.py:131 msgid "carousels" msgstr "karuzele" -#: models.py:98 +#: models.py:137 msgid "order" msgstr "kolejność" -#: models.py:106 +#: models.py:145 msgid "carousel item" msgstr "element karuzeli" -#: models.py:107 +#: models.py:146 msgid "carousel items" msgstr "elementy karuzeli" -#: models.py:114 models.py:116 +#: models.py:153 models.py:155 msgid "Either banner or banner group is required." msgstr "Proszę wskazać banner albo grupę bannerów." -#: templates/social/cite_promo.html:14 +#: templates/social/cite_promo.html:23 msgid "recommends" msgstr "poleca" @@ -187,10 +216,28 @@ msgstr "" "na stronie utworu. Po jej zaznaczeniu publikacja pojawi się w zakładce Moja " "półka." -#: templates/social/sets_form.html:8 +#: templates/social/sets_form.html:7 msgid "Remove from my shelf" msgstr "Usuń z mojej półki" +#~ msgid "Adjust size to image, ignore the text" +#~ msgstr "Dostosuj wielkość do obrazu tła, zignoruj tekst." + +#~ msgid "shift" +#~ msgstr "przesunięcie" + +#~ msgid "" +#~ "Vertical shift, in percents. 0 means top, 100 is bottom. Default is 50%." +#~ msgstr "" +#~ "Przesunięcie w pionie, w procentach. 0 to wyrównanie do górnej krawędzi, " +#~ "100 do dolnej. Domyślne jest 50%." + +#~ msgid "title" +#~ msgstr "tytuł" + +#~ msgid "author" +#~ msgstr "autor" + #~ msgid "cite" #~ msgstr "cytat" diff --git a/src/social/migrations/0011_auto_20190807_1056.py b/src/social/migrations/0011_auto_20190807_1056.py new file mode 100644 index 000000000..1b320d305 --- /dev/null +++ b/src/social/migrations/0011_auto_20190807_1056.py @@ -0,0 +1,56 @@ +# Generated by Django 2.1.11 on 2019-08-07 08:56 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('social', '0010_cite_background_plain'), + ] + + operations = [ + migrations.RemoveField( + model_name='cite', + name='banner', + ), + migrations.RemoveField( + model_name='cite', + name='image_shift', + ), + migrations.AlterField( + model_name='cite', + name='image', + field=models.ImageField(blank=True, help_text='Best background is 975 x 315 px and under 100kB.', null=True, upload_to='social/cite', verbose_name='background image'), + ), + migrations.AlterField( + model_name='cite', + name='image_author', + field=models.CharField(blank=True, max_length=255, null=True, verbose_name='background author'), + ), + migrations.AlterField( + model_name='cite', + name='image_license', + field=models.CharField(blank=True, max_length=255, null=True, verbose_name='background license name'), + ), + migrations.AlterField( + model_name='cite', + name='image_license_link', + field=models.URLField(blank=True, null=True, verbose_name='background license link'), + ), + migrations.AlterField( + model_name='cite', + name='image_link', + field=models.URLField(blank=True, null=True, verbose_name='background link'), + ), + migrations.AlterField( + model_name='cite', + name='image_title', + field=models.CharField(blank=True, max_length=255, null=True, verbose_name='background title'), + ), + migrations.AlterField( + model_name='cite', + name='picture', + field=models.ImageField(blank=True, help_text='Najlepsze wymiary: 975 x 315 z tekstem, 487 x 315 bez tekstu.', upload_to='', verbose_name='picture'), + ), + ] diff --git a/src/social/models.py b/src/social/models.py index 29029ee6b..37cfecd24 100644 --- a/src/social/models.py +++ b/src/social/models.py @@ -53,24 +53,16 @@ class Cite(models.Model): sticky = models.BooleanField(_('sticky'), default=False, db_index=True, help_text=_('Sticky cites will take precedense.')) - banner = models.BooleanField(_('banner'), default=False, help_text= - 'Dostosuj wielkość do obrazu tła, zignoruj tekst.' - '
(Przestarzałe; użyj funkcji "Obraz" w sekcji "Media box")') - background_plain = models.BooleanField(_('plain background'), default=False) background_color = models.CharField(_('background color'), max_length=32, blank=True) image = models.ImageField( - _('image'), upload_to='social/cite', null=True, blank=True, - help_text=_('Best image is exactly 975px wide and weights under 100kB.')) - image_shift = models.IntegerField( - _('shift'), null=True, blank=True, - help_text='Przesunięcie w pionie, w procentach. 0 to wyrównanie do górnej krawędzi, 100 do dolnej. Domyślne jest 50%.' - '
(Przestarzałe; użyj obrazka o właściwych proporcjach;)') - image_title = models.CharField(_('title'), max_length=255, null=True, blank=True) - image_author = models.CharField(_('author'), max_length=255, blank=True, null=True) - image_link = models.URLField(_('link'), blank=True, null=True) - image_license = models.CharField(_('license name'), max_length=255, blank=True, null=True) - image_license_link = models.URLField(_('license link'), blank=True, null=True) + _('background image'), upload_to='social/cite', null=True, blank=True, + help_text=_('Best background is 975 x 315 px and under 100kB.')) + image_title = models.CharField(_('background title'), max_length=255, null=True, blank=True) + image_author = models.CharField(_('background author'), max_length=255, blank=True, null=True) + image_link = models.URLField(_('background link'), blank=True, null=True) + image_license = models.CharField(_('background license name'), max_length=255, blank=True, null=True) + image_license_link = models.URLField(_('background license link'), blank=True, null=True) created_at = models.DateTimeField(_('created at'), auto_now_add=True) group = models.ForeignKey(BannerGroup, verbose_name=_('group'), null=True, blank=True, on_delete=models.SET_NULL) @@ -106,9 +98,6 @@ class Cite(models.Model): return self.vip or self.text or self.book def layout(self): - if self.banner: - # TODO: move all banners to pictures. - return 'banner' pieces = [] if self.has_box(): pieces.append('box') diff --git a/src/social/templates/social/cite_promo.html b/src/social/templates/social/cite_promo.html index 10126a6cd..6051710a6 100644 --- a/src/social/templates/social/cite_promo.html +++ b/src/social/templates/social/cite_promo.html @@ -3,15 +3,11 @@ {% load embed_video from social_tags %} {% if main %} -
+
{% endif %} {% if cite %} - {% if cite.banner %} - {# Obsolete #} - - {% else %} {% if cite.video %}
{% embed_video cite.video %} @@ -35,7 +31,6 @@

{{ cite.book.pretty_title }}

{% endif %}
- {% endif %}
{% endif %} diff --git a/src/wolnelektury/settings/apps.py b/src/wolnelektury/settings/apps.py index 241b4b791..320f6ddd4 100644 --- a/src/wolnelektury/settings/apps.py +++ b/src/wolnelektury/settings/apps.py @@ -1,7 +1,6 @@ # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later. # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. - -from machina import get_apps as get_machina_apps +# INSTALLED_APPS_OUR = [ 'wolnelektury', @@ -71,10 +70,23 @@ INSTALLED_APPS_CONTRIB = [ 'allauth.socialaccount.providers.google', # 'allauth.socialaccount.providers.twitter', - # Machina related apps: + # Machina dependencies: 'mptt', 'haystack', 'widget_tweaks', -] + get_machina_apps() + + # Machina apps: + 'machina', + 'machina.apps.forum', + 'machina.apps.forum_conversation', + 'machina.apps.forum_conversation.forum_attachments', + 'machina.apps.forum_conversation.forum_polls', + 'machina.apps.forum_feeds', + 'machina.apps.forum_moderation', + 'machina.apps.forum_search', + 'machina.apps.forum_tracking', + 'machina.apps.forum_member', + 'machina.apps.forum_permission', +] INSTALLED_APPS = INSTALLED_APPS_OUR + INSTALLED_APPS_CONTRIB diff --git a/src/wolnelektury/settings/static.py b/src/wolnelektury/settings/static.py index 6cf76662d..f2a8423bb 100644 --- a/src/wolnelektury/settings/static.py +++ b/src/wolnelektury/settings/static.py @@ -56,6 +56,12 @@ PIPELINE = { ], 'output_filename': 'css/compressed/book_text.css', }, + 'forum': { + 'source_filenames': [ + 'scss/forum.scss', + ], + 'output_filename': 'css/compressed/compressed/forum.css', + }, 'picture': { 'source_filenames': [ 'css/master.book.css', diff --git a/src/wolnelektury/static/img/backdrop/book-drawer-315.jpg b/src/wolnelektury/static/img/backdrop/book-drawer-315.jpg new file mode 100644 index 000000000..4b27ef69a Binary files /dev/null and b/src/wolnelektury/static/img/backdrop/book-drawer-315.jpg differ diff --git a/src/wolnelektury/static/img/logo-neon-transp.png b/src/wolnelektury/static/img/logo-neon-transp.png new file mode 100644 index 000000000..15d9bb1f5 Binary files /dev/null and b/src/wolnelektury/static/img/logo-neon-transp.png differ diff --git a/src/wolnelektury/static/scss/forum.scss b/src/wolnelektury/static/scss/forum.scss new file mode 100644 index 000000000..50f94ab39 --- /dev/null +++ b/src/wolnelektury/static/scss/forum.scss @@ -0,0 +1,8 @@ +.navbar { + .navbar-brand { + padding-top: 0; + padding-bottom: 0; + margin-top: -2px; + margin-bottom: -2px; + } +} diff --git a/src/wolnelektury/static/scss/main/main_page.scss b/src/wolnelektury/static/scss/main/main_page.scss index dd8ece49d..aee13d824 100755 --- a/src/wolnelektury/static/scss/main/main_page.scss +++ b/src/wolnelektury/static/scss/main/main_page.scss @@ -4,13 +4,9 @@ padding: 0; margin: 0; background-size: cover; - background-position: 50% 68%; + background-position: 50% 50%; - background-image: url(/static/img/backdrop/book-drawer2.jpg); - - &.banner { - background: none; - } + background-image: url(/static/img/backdrop/book-drawer-315.jpg); .cite-box, .cite-box-text, .cite-text { box-sizing: border-box; diff --git a/src/wolnelektury/templates/board_base.html b/src/wolnelektury/templates/board_base.html index cadb6bbe8..29dff3c56 100644 --- a/src/wolnelektury/templates/board_base.html +++ b/src/wolnelektury/templates/board_base.html @@ -1,48 +1,55 @@ -{% extends "board_base.html" %} +{% extends 'board_base.html' %} {% load i18n %} +{% load static %} +{% load stylesheet from pipeline %} + +{% block css %} + {{ block.super }} + {% stylesheet 'forum' %} +{% endblock css %} + + {% block header %} + {% endblock header %} diff --git a/src/wolnelektury/urls.py b/src/wolnelektury/urls.py index d765e7dab..97443fa77 100644 --- a/src/wolnelektury/urls.py +++ b/src/wolnelektury/urls.py @@ -6,7 +6,6 @@ from django.conf import settings from django.contrib import admin from django.views.generic import RedirectView import django.views.static -from machina.app import board import catalogue.views import picture.views from . import views @@ -70,7 +69,7 @@ urlpatterns += [ url(r'^szukaj/', include('search.urls')), url(r'^i18n/', include('django.conf.urls.i18n')), - url(r'^forum/', include(board.urls)), + url(r'^forum/', include('machina.urls')), ] urlpatterns += [