From: Frédéric Péters Date: Thu, 26 Oct 2023 08:06:43 +0000 (+0200) Subject: add introduction to fullwidth page placeholders X-Git-Url: https://git.0d.be/?p=django-panik-combo.git;a=commitdiff_plain;h=HEAD;hp=eacfdf03e6e3539da2caac41d8c35a49bef6e9b0 add introduction to fullwidth page placeholders --- diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs new file mode 100644 index 0000000..ae5db9a --- /dev/null +++ b/.git-blame-ignore-revs @@ -0,0 +1,2 @@ +# trivial: apply black +f89a5d9eaa646c846c9f464a0ab9c6ae262fdb19 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..5f6e56d --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,28 @@ +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks +repos: + - repo: https://github.com/asottile/pyupgrade + rev: v3.3.1 + hooks: + - id: pyupgrade + args: ['--keep-percent-format', '--py39-plus'] + - repo: https://github.com/adamchainz/django-upgrade + rev: 1.10.0 + hooks: + - id: django-upgrade + args: [--target-version, "3.2"] + - repo: https://github.com/psf/black + rev: 23.1.0 + hooks: + - id: black + args: ['--target-version', 'py39', '--skip-string-normalization', '--line-length', '110'] + - repo: https://github.com/PyCQA/isort + rev: 5.12.0 + hooks: + - id: isort + args: ['--profile', 'black', '--line-length', '110'] + - repo: https://github.com/rtts/djhtml + rev: '3.0.5' + hooks: + - id: djhtml + args: ['--tabwidth', '2'] diff --git a/MANIFEST.in b/MANIFEST.in index 37eb2a0..009e33b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,6 +2,7 @@ include AUTHORS include COPYING include README include MANIFEST.in +include VERSION recursive-include panikombo/static *.js recursive-include panikombo/templates *.html diff --git a/debian/compat b/debian/compat deleted file mode 100644 index f599e28..0000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -10 diff --git a/debian/control b/debian/control index cc821a7..e19d59b 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: django-panik-combo Section: python Priority: optional Maintainer: Frederic Peters -Build-Depends: debhelper (>= 10), +Build-Depends: debhelper-compat (= 12), python3-all, python3-django, python3-setuptools, diff --git a/panikombo/forms.py b/panikombo/forms.py index c84dbfa..cb2d5f5 100644 --- a/panikombo/forms.py +++ b/panikombo/forms.py @@ -1,13 +1,9 @@ -import json - from django import forms from django.forms.widgets import Widget +from emissions.models import Episode, SoundFile from taggit.forms import TagWidget -from emissions.models import SoundFile, Episode - -from .models import (SoundCell, EpisodeCell, EpisodeAutoSelectionCell, - NewsItemAutoSelectionCell) +from .models import EpisodeAutoSelectionCell, EpisodeCell, NewsItemAutoSelectionCell, SoundCell class BaseSelect2Widget(Widget): @@ -29,9 +25,11 @@ class SoundFileWidget(BaseSelect2Widget): soundfile = SoundFile.objects.get(id=value) except SoundFile.DoesNotExist: return 'missing sound %s' % value - return '%s - %s - %s' % (soundfile.episode.emission.title, - soundfile.episode.title, - soundfile.title or soundfile.id) + return '%s - %s - %s' % ( + soundfile.episode.emission.title, + soundfile.episode.title, + soundfile.title or soundfile.id, + ) class SoundCellForm(forms.ModelForm): @@ -40,7 +38,7 @@ class SoundCellForm(forms.ModelForm): fields = ('soundfile',) def __init__(self, *args, **kwargs): - super(SoundCellForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.fields['soundfile'].widget = SoundFileWidget() @@ -58,10 +56,10 @@ class EpisodeWidget(BaseSelect2Widget): class EpisodeCellForm(forms.ModelForm): class Meta: model = EpisodeCell - fields = ('episode', ) + fields = ('episode',) def __init__(self, *args, **kwargs): - super(EpisodeCellForm, self).__init__(*args, **kwargs) + super().__init__(*args, **kwargs) self.fields['episode'].widget = EpisodeWidget() @@ -75,5 +73,5 @@ class EpisodeAutoSelectionCellForm(forms.ModelForm): class NewsItemAutoSelectionCellForm(forms.ModelForm): class Meta: model = NewsItemAutoSelectionCell - fields = ('title', 'tags', 'and_tags', 'category', 'future') + fields = ('tags', 'and_tags', 'category', 'future', 'count') widgets = {'tags': TagWidget()} diff --git a/panikombo/management/commands/map-item-topik.py b/panikombo/management/commands/map-item-topik.py index 61b765c..56bfc01 100644 --- a/panikombo/management/commands/map-item-topik.py +++ b/panikombo/management/commands/map-item-topik.py @@ -1,8 +1,7 @@ +from combo.data.models import CellBase, Page from django.core.management.base import BaseCommand, CommandError +from emissions.models import Episode, NewsItem -from emissions.models import NewsItem, Episode - -from combo.data.models import Page, CellBase from panikombo.models import ItemTopik diff --git a/panikombo/migrations/0001_initial.py b/panikombo/migrations/0001_initial.py index fef818b..ee317b1 100644 --- a/panikombo/migrations/0001_initial.py +++ b/panikombo/migrations/0001_initial.py @@ -1,11 +1,7 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('auth', '0001_initial'), ('emissions', '0001_initial'), @@ -16,14 +12,20 @@ class Migration(migrations.Migration): migrations.CreateModel( name='SoundCell', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ( + 'id', + models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True), + ), ('placeholder', models.CharField(max_length=20)), ('order', models.PositiveIntegerField()), ('slug', models.SlugField(verbose_name='Slug', blank=True)), ('public', models.BooleanField(default=True, verbose_name='Public')), ('groups', models.ManyToManyField(to='auth.Group', verbose_name='Groups', blank=True)), - ('page', models.ForeignKey(to='data.Page')), - ('soundfile', models.ForeignKey(to='emissions.SoundFile', null=True)), + ('page', models.ForeignKey(to='data.Page', on_delete=models.SET_NULL)), + ( + 'soundfile', + models.ForeignKey(to='emissions.SoundFile', null=True, on_delete=models.SET_NULL), + ), ], options={ 'verbose_name': 'Sound', diff --git a/panikombo/migrations/0002_episodecell.py b/panikombo/migrations/0002_episodecell.py index 712f20b..afd7709 100644 --- a/panikombo/migrations/0002_episodecell.py +++ b/panikombo/migrations/0002_episodecell.py @@ -1,11 +1,7 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('auth', '0001_initial'), ('emissions', '0003_newsitem_event_date'), @@ -17,14 +13,17 @@ class Migration(migrations.Migration): migrations.CreateModel( name='EpisodeCell', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ( + 'id', + models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True), + ), ('placeholder', models.CharField(max_length=20)), ('order', models.PositiveIntegerField()), ('slug', models.SlugField(verbose_name='Slug', blank=True)), ('public', models.BooleanField(default=True, verbose_name='Public')), - ('episode', models.ForeignKey(to='emissions.Episode', null=True)), + ('episode', models.ForeignKey(to='emissions.Episode', null=True, on_delete=models.SET_NULL)), ('groups', models.ManyToManyField(to='auth.Group', verbose_name='Groups', blank=True)), - ('page', models.ForeignKey(to='data.Page')), + ('page', models.ForeignKey(to='data.Page', on_delete=models.SET_NULL)), ], options={ 'verbose_name': 'Episode', diff --git a/panikombo/migrations/0003_episodeautoselectioncell.py b/panikombo/migrations/0003_episodeautoselectioncell.py index 70663a7..185ff72 100644 --- a/panikombo/migrations/0003_episodeautoselectioncell.py +++ b/panikombo/migrations/0003_episodeautoselectioncell.py @@ -1,12 +1,8 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations import taggit.managers +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('auth', '0001_initial'), ('data', '0005_auto_20150226_0903'), @@ -19,16 +15,33 @@ class Migration(migrations.Migration): migrations.CreateModel( name='EpisodeAutoSelectionCell', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ( + 'id', + models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True), + ), ('placeholder', models.CharField(max_length=20)), ('order', models.PositiveIntegerField()), ('slug', models.SlugField(verbose_name='Slug', blank=True)), ('public', models.BooleanField(default=True, verbose_name='Public')), ('title', models.CharField(max_length=50, verbose_name='Title', blank=True)), - ('category', models.ForeignKey(blank=True, to='emissions.Category', null=True)), + ( + 'category', + models.ForeignKey( + blank=True, to='emissions.Category', null=True, on_delete=models.SET_NULL + ), + ), ('groups', models.ManyToManyField(to='auth.Group', verbose_name='Groups', blank=True)), - ('page', models.ForeignKey(to='data.Page')), - ('tags', taggit.managers.TaggableManager(to='taggit.Tag', through='taggit.TaggedItem', blank=True, help_text='A comma-separated list of tags.', verbose_name='Tags')), + ('page', models.ForeignKey(to='data.Page', on_delete=models.SET_NULL)), + ( + 'tags', + taggit.managers.TaggableManager( + to='taggit.Tag', + through='taggit.TaggedItem', + blank=True, + help_text='A comma-separated list of tags.', + verbose_name='Tags', + ), + ), ], options={ 'verbose_name': 'Automatic Episode Selection', diff --git a/panikombo/migrations/0004_newsitemautoselectioncell.py b/panikombo/migrations/0004_newsitemautoselectioncell.py index f8efc3b..d6fb2f6 100644 --- a/panikombo/migrations/0004_newsitemautoselectioncell.py +++ b/panikombo/migrations/0004_newsitemautoselectioncell.py @@ -1,12 +1,8 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations import taggit.managers +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('auth', '0001_initial'), ('data', '0005_auto_20150226_0903'), @@ -18,7 +14,10 @@ class Migration(migrations.Migration): migrations.CreateModel( name='NewsItemAutoSelectionCell', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ( + 'id', + models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True), + ), ('placeholder', models.CharField(max_length=20)), ('order', models.PositiveIntegerField()), ('slug', models.SlugField(verbose_name='Slug', blank=True)), @@ -26,8 +25,17 @@ class Migration(migrations.Migration): ('title', models.CharField(max_length=50, verbose_name='Title', blank=True)), ('future', models.BooleanField(default=True, verbose_name='Future Events Only')), ('groups', models.ManyToManyField(to='auth.Group', verbose_name='Groups', blank=True)), - ('page', models.ForeignKey(to='data.Page')), - ('tags', taggit.managers.TaggableManager(to='taggit.Tag', through='taggit.TaggedItem', blank=True, help_text='A comma-separated list of tags.', verbose_name='Tags')), + ('page', models.ForeignKey(to='data.Page', on_delete=models.SET_NULL)), + ( + 'tags', + taggit.managers.TaggableManager( + to='taggit.Tag', + through='taggit.TaggedItem', + blank=True, + help_text='A comma-separated list of tags.', + verbose_name='Tags', + ), + ), ], options={ 'verbose_name': 'Automatic Newsitem Selection', diff --git a/panikombo/migrations/0005_topik.py b/panikombo/migrations/0005_topik.py index d2e339b..6560a84 100644 --- a/panikombo/migrations/0005_topik.py +++ b/panikombo/migrations/0005_topik.py @@ -1,11 +1,7 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('data', '0005_auto_20150226_0903'), ('panikombo', '0004_newsitemautoselectioncell'), @@ -15,14 +11,16 @@ class Migration(migrations.Migration): migrations.CreateModel( name='Topik', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ( + 'id', + models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True), + ), ('image', models.ImageField(max_length=250, null=True, verbose_name='Image', blank=True)), ('got_focus', models.DateTimeField(default=None, null=True, blank=True)), ('has_focus', models.BooleanField(default=False)), - ('page', models.ForeignKey(to='data.Page')), + ('page', models.ForeignKey(to='data.Page', on_delete=models.CASCADE)), ], - options={ - }, + options={}, bases=(models.Model,), ), ] diff --git a/panikombo/migrations/0006_itemtopik.py b/panikombo/migrations/0006_itemtopik.py index 69db3e1..ce738f6 100644 --- a/panikombo/migrations/0006_itemtopik.py +++ b/panikombo/migrations/0006_itemtopik.py @@ -1,11 +1,7 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('emissions', '0004_focus_page'), ('panikombo', '0005_topik'), @@ -15,13 +11,42 @@ class Migration(migrations.Migration): migrations.CreateModel( name='ItemTopik', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), - ('episode', models.ForeignKey(verbose_name='Episode', blank=True, to='emissions.Episode', null=True)), - ('newsitem', models.ForeignKey(verbose_name='News Item', blank=True, to='emissions.NewsItem', null=True)), - ('topik', models.ForeignKey(verbose_name=b'Topik', blank=True, to='panikombo.Topik', null=True)), + ( + 'id', + models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True), + ), + ( + 'episode', + models.ForeignKey( + verbose_name='Episode', + blank=True, + to='emissions.Episode', + null=True, + on_delete=models.SET_NULL, + ), + ), + ( + 'newsitem', + models.ForeignKey( + verbose_name='News Item', + blank=True, + to='emissions.NewsItem', + null=True, + on_delete=models.SET_NULL, + ), + ), + ( + 'topik', + models.ForeignKey( + verbose_name=b'Topik', + blank=True, + to='panikombo.Topik', + null=True, + on_delete=models.SET_NULL, + ), + ), ], - options={ - }, + options={}, bases=(models.Model,), ), ] diff --git a/panikombo/migrations/0007_newsitemautoselectioncell_category.py b/panikombo/migrations/0007_newsitemautoselectioncell_category.py index 99db4c7..834289f 100644 --- a/panikombo/migrations/0007_newsitemautoselectioncell_category.py +++ b/panikombo/migrations/0007_newsitemautoselectioncell_category.py @@ -1,11 +1,7 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('emissions', '0004_focus_page'), ('panikombo', '0006_itemtopik'), @@ -15,7 +11,13 @@ class Migration(migrations.Migration): migrations.AddField( model_name='newsitemautoselectioncell', name='category', - field=models.ForeignKey(verbose_name='Category', blank=True, to='emissions.NewsCategory', null=True), + field=models.ForeignKey( + verbose_name='Category', + blank=True, + to='emissions.NewsCategory', + null=True, + on_delete=models.SET_NULL, + ), preserve_default=True, ), ] diff --git a/panikombo/migrations/0008_topikcell.py b/panikombo/migrations/0008_topikcell.py index e117285..79ba8c0 100644 --- a/panikombo/migrations/0008_topikcell.py +++ b/panikombo/migrations/0008_topikcell.py @@ -1,12 +1,8 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations import ckeditor.fields +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('auth', '0001_initial'), ('data', '0009_auto_20150529_2247'), @@ -17,15 +13,18 @@ class Migration(migrations.Migration): migrations.CreateModel( name='TopikCell', fields=[ - ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), + ( + 'id', + models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True), + ), ('placeholder', models.CharField(max_length=20)), ('order', models.PositiveIntegerField()), ('slug', models.SlugField(verbose_name='Slug', blank=True)), ('public', models.BooleanField(default=True, verbose_name='Public')), ('text', ckeditor.fields.RichTextField(null=True, verbose_name='Text', blank=True)), ('groups', models.ManyToManyField(to='auth.Group', verbose_name='Groups', blank=True)), - ('page', models.ForeignKey(to='data.Page')), - ('topik', models.ForeignKey(to='panikombo.Topik', null=True)), + ('page', models.ForeignKey(to='data.Page', on_delete=models.SET_NULL)), + ('topik', models.ForeignKey(to='panikombo.Topik', null=True, on_delete=models.SET_NULL)), ], options={ 'verbose_name': 'Topik', diff --git a/panikombo/migrations/0009_episodeautoselectioncell_period.py b/panikombo/migrations/0009_episodeautoselectioncell_period.py index fdd0c87..4cfa1b5 100644 --- a/panikombo/migrations/0009_episodeautoselectioncell_period.py +++ b/panikombo/migrations/0009_episodeautoselectioncell_period.py @@ -1,11 +1,7 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('panikombo', '0008_topikcell'), ] @@ -14,7 +10,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='episodeautoselectioncell', name='period', - field=models.PositiveSmallIntegerField(default=0, verbose_name='Period', choices=[(0, 'All'), (1, 'Future'), (2, 'Past')]), + field=models.PositiveSmallIntegerField( + default=0, verbose_name='Period', choices=[(0, 'All'), (1, 'Future'), (2, 'Past')] + ), preserve_default=True, ), ] diff --git a/panikombo/migrations/0010_auto_20160220_1153.py b/panikombo/migrations/0010_auto_20160220_1153.py index ce0e183..d20369d 100644 --- a/panikombo/migrations/0010_auto_20160220_1153.py +++ b/panikombo/migrations/0010_auto_20160220_1153.py @@ -1,11 +1,7 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('panikombo', '0009_episodeautoselectioncell_period'), ] diff --git a/panikombo/migrations/0011_auto_20170418_1154.py b/panikombo/migrations/0011_auto_20170418_1154.py index a77b781..2763738 100644 --- a/panikombo/migrations/0011_auto_20170418_1154.py +++ b/panikombo/migrations/0011_auto_20170418_1154.py @@ -1,12 +1,9 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals +import datetime from django.db import migrations, models -import datetime class Migration(migrations.Migration): - dependencies = [ ('panikombo', '0010_auto_20160220_1153'), ] @@ -20,7 +17,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='episodeautoselectioncell', name='last_update_timestamp', - field=models.DateTimeField(default=datetime.datetime(2017, 4, 18, 11, 54, 35, 51768), auto_now=True), + field=models.DateTimeField( + default=datetime.datetime(2017, 4, 18, 11, 54, 35, 51768), auto_now=True + ), preserve_default=False, ), migrations.AddField( @@ -31,7 +30,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='episodecell', name='last_update_timestamp', - field=models.DateTimeField(default=datetime.datetime(2017, 4, 18, 11, 54, 36, 700929), auto_now=True), + field=models.DateTimeField( + default=datetime.datetime(2017, 4, 18, 11, 54, 36, 700929), auto_now=True + ), preserve_default=False, ), migrations.AddField( @@ -42,7 +43,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='newsitemautoselectioncell', name='last_update_timestamp', - field=models.DateTimeField(default=datetime.datetime(2017, 4, 18, 11, 54, 39, 362967), auto_now=True), + field=models.DateTimeField( + default=datetime.datetime(2017, 4, 18, 11, 54, 39, 362967), auto_now=True + ), preserve_default=False, ), migrations.AddField( @@ -53,7 +56,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='soundcell', name='last_update_timestamp', - field=models.DateTimeField(default=datetime.datetime(2017, 4, 18, 11, 54, 42, 662255), auto_now=True), + field=models.DateTimeField( + default=datetime.datetime(2017, 4, 18, 11, 54, 42, 662255), auto_now=True + ), preserve_default=False, ), migrations.AddField( @@ -64,7 +69,9 @@ class Migration(migrations.Migration): migrations.AddField( model_name='topikcell', name='last_update_timestamp', - field=models.DateTimeField(default=datetime.datetime(2017, 4, 18, 11, 54, 44, 42144), auto_now=True), + field=models.DateTimeField( + default=datetime.datetime(2017, 4, 18, 11, 54, 44, 42144), auto_now=True + ), preserve_default=False, ), ] diff --git a/panikombo/migrations/0012_auto_20171015_1027.py b/panikombo/migrations/0012_auto_20171015_1027.py index 73beee0..207adae 100644 --- a/panikombo/migrations/0012_auto_20171015_1027.py +++ b/panikombo/migrations/0012_auto_20171015_1027.py @@ -1,11 +1,7 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('panikombo', '0011_auto_20170418_1154'), ] diff --git a/panikombo/migrations/0013_auto_20200611_1121.py b/panikombo/migrations/0013_auto_20200611_1121.py index 384a5d2..1cf6dbb 100644 --- a/panikombo/migrations/0013_auto_20200611_1121.py +++ b/panikombo/migrations/0013_auto_20200611_1121.py @@ -1,13 +1,10 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.29 on 2020-06-11 11:21 -from __future__ import unicode_literals -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('data', '0009_auto_20150529_2247'), ('panikombo', '0012_auto_20171015_1027'), @@ -17,11 +14,19 @@ class Migration(migrations.Migration): migrations.AddField( model_name='itemtopik', name='page', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='data.Page'), + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='data.Page' + ), ), migrations.AlterField( model_name='itemtopik', name='topik', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='panikombo.Topik', verbose_name='Topik'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + to='panikombo.Topik', + verbose_name='Topik', + ), ), ] diff --git a/panikombo/migrations/0014_remove_itemtopik_topik.py b/panikombo/migrations/0014_remove_itemtopik_topik.py index 2ea5843..4d025d5 100644 --- a/panikombo/migrations/0014_remove_itemtopik_topik.py +++ b/panikombo/migrations/0014_remove_itemtopik_topik.py @@ -1,12 +1,9 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.29 on 2020-06-11 11:26 -from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ('panikombo', '0013_auto_20200611_1121'), ] diff --git a/panikombo/migrations/0015_auto_20200611_1250.py b/panikombo/migrations/0015_auto_20200611_1250.py index dbbdb14..3ddd807 100644 --- a/panikombo/migrations/0015_auto_20200611_1250.py +++ b/panikombo/migrations/0015_auto_20200611_1250.py @@ -1,12 +1,9 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.29 on 2020-06-11 12:50 -from __future__ import unicode_literals from django.db import migrations class Migration(migrations.Migration): - dependencies = [ ('panikombo', '0014_remove_itemtopik_topik'), ] diff --git a/panikombo/migrations/0016_soundscell.py b/panikombo/migrations/0016_soundscell.py index 829e1c6..85a02fe 100644 --- a/panikombo/migrations/0016_soundscell.py +++ b/panikombo/migrations/0016_soundscell.py @@ -1,13 +1,10 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.29 on 2020-11-21 12:40 -from __future__ import unicode_literals -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('auth', '0008_alter_user_username_max_length'), ('panikombo', '0015_auto_20200611_1250'), @@ -17,17 +14,34 @@ class Migration(migrations.Migration): migrations.CreateModel( name='SoundsCell', fields=[ - ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ( + 'id', + models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), + ), ('placeholder', models.CharField(max_length=20)), ('order', models.PositiveIntegerField()), ('slug', models.SlugField(blank=True, verbose_name='Slug')), - ('extra_css_class', models.CharField(blank=True, max_length=100, verbose_name='Extra classes for CSS styling')), + ( + 'extra_css_class', + models.CharField( + blank=True, max_length=100, verbose_name='Extra classes for CSS styling' + ), + ), ('public', models.BooleanField(default=True, verbose_name='Public')), - ('restricted_to_unlogged', models.BooleanField(default=False, verbose_name='Restrict to unlogged users')), + ( + 'restricted_to_unlogged', + models.BooleanField(default=False, verbose_name='Restrict to unlogged users'), + ), ('last_update_timestamp', models.DateTimeField(auto_now=True)), - ('include_search_input', models.BooleanField(default=True, verbose_name='Include search input')), + ( + 'include_search_input', + models.BooleanField(default=True, verbose_name='Include search input'), + ), ('include_fragments', models.BooleanField(default=True, verbose_name='Include fragments')), - ('limit_to_focus', models.BooleanField(default=False, verbose_name='Limit to focused elements')), + ( + 'limit_to_focus', + models.BooleanField(default=False, verbose_name='Limit to focused elements'), + ), ('count', models.PositiveSmallIntegerField(default=20, verbose_name='Count')), ('groups', models.ManyToManyField(blank=True, to='auth.Group', verbose_name='Groups')), ('page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='data.Page')), diff --git a/panikombo/migrations/0017_soundscell_title.py b/panikombo/migrations/0017_soundscell_title.py index e8fdca9..43234f6 100644 --- a/panikombo/migrations/0017_soundscell_title.py +++ b/panikombo/migrations/0017_soundscell_title.py @@ -1,12 +1,9 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.29 on 2020-11-21 14:33 -from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('panikombo', '0016_soundscell'), ] diff --git a/panikombo/migrations/0018_soundscell_sort_order.py b/panikombo/migrations/0018_soundscell_sort_order.py index a7a1456..04c86b0 100644 --- a/panikombo/migrations/0018_soundscell_sort_order.py +++ b/panikombo/migrations/0018_soundscell_sort_order.py @@ -1,12 +1,9 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.29 on 2020-11-21 20:58 -from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('panikombo', '0017_soundscell_title'), ] @@ -15,6 +12,17 @@ class Migration(migrations.Migration): migrations.AddField( model_name='soundscell', name='sort_order', - field=models.CharField(choices=[('-creation_timestamp', 'Reverse chronological (creation)'), ('-first_diffusion', 'Reverse chronological (diffusion)'), ('creation_timestamp', 'Chronological (creation)'), ('first_diffusion', 'Chronological (diffusion)'), ('?', 'Random')], default='-creation_timestamp', max_length=30, verbose_name='Sort order'), + field=models.CharField( + choices=[ + ('-creation_timestamp', 'Reverse chronological (creation)'), + ('-first_diffusion', 'Reverse chronological (diffusion)'), + ('creation_timestamp', 'Chronological (creation)'), + ('first_diffusion', 'Chronological (diffusion)'), + ('?', 'Random'), + ], + default='-creation_timestamp', + max_length=30, + verbose_name='Sort order', + ), ), ] diff --git a/panikombo/migrations/0019_soundscell_sound_format.py b/panikombo/migrations/0019_soundscell_sound_format.py index 2530f12..0f3205f 100644 --- a/panikombo/migrations/0019_soundscell_sound_format.py +++ b/panikombo/migrations/0019_soundscell_sound_format.py @@ -1,13 +1,10 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.29 on 2020-11-22 14:02 -from __future__ import unicode_literals -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('emissions', '0015_auto_20200404_1510'), ('panikombo', '0018_soundscell_sort_order'), @@ -17,6 +14,12 @@ class Migration(migrations.Migration): migrations.AddField( model_name='soundscell', name='sound_format', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='emissions.Format', verbose_name='Limit to format'), + field=models.ForeignKey( + blank=True, + null=True, + on_delete=django.db.models.deletion.CASCADE, + to='emissions.Format', + verbose_name='Limit to format', + ), ), ] diff --git a/panikombo/migrations/0020_auto_20201122_2005.py b/panikombo/migrations/0020_auto_20201122_2005.py index b3d1396..b52f926 100644 --- a/panikombo/migrations/0020_auto_20201122_2005.py +++ b/panikombo/migrations/0020_auto_20201122_2005.py @@ -1,12 +1,9 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.29 on 2020-11-22 20:05 -from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): - dependencies = [ ('panikombo', '0019_soundscell_sound_format'), ] @@ -15,11 +12,15 @@ class Migration(migrations.Migration): migrations.AddField( model_name='soundscell', name='maximal_duration', - field=models.PositiveIntegerField(blank=True, default=None, null=True, verbose_name='Maximal duration (in minutes)'), + field=models.PositiveIntegerField( + blank=True, default=None, null=True, verbose_name='Maximal duration (in minutes)' + ), ), migrations.AddField( model_name='soundscell', name='minimal_duration', - field=models.PositiveIntegerField(blank=True, default=None, null=True, verbose_name='Minimal duration (in minutes)'), + field=models.PositiveIntegerField( + blank=True, default=None, null=True, verbose_name='Minimal duration (in minutes)' + ), ), ] diff --git a/panikombo/migrations/0021_soundscell_tags.py b/panikombo/migrations/0021_soundscell_tags.py index 45e83e9..d6777ff 100644 --- a/panikombo/migrations/0021_soundscell_tags.py +++ b/panikombo/migrations/0021_soundscell_tags.py @@ -1,15 +1,11 @@ -# -*- coding: utf-8 -*- # Generated by Django 1.11.29 on 2020-11-26 12:52 -from __future__ import unicode_literals -from django.db import migrations import taggit.managers +from django.db import migrations class Migration(migrations.Migration): - dependencies = [ - ('taggit', '0003_taggeditem_add_unique_index'), ('panikombo', '0020_auto_20201122_2005'), ] @@ -17,6 +13,12 @@ class Migration(migrations.Migration): migrations.AddField( model_name='soundscell', name='tags', - field=taggit.managers.TaggableManager(blank=True, help_text='A comma-separated list of tags.', through='taggit.TaggedItem', to='taggit.Tag', verbose_name='Tags'), + field=taggit.managers.TaggableManager( + blank=True, + help_text='A comma-separated list of tags.', + through='taggit.TaggedItem', + to='taggit.Tag', + verbose_name='Tags', + ), ), ] diff --git a/panikombo/migrations/0022_auto_20210326_1324.py b/panikombo/migrations/0022_auto_20210326_1324.py new file mode 100644 index 0000000..1aa6f54 --- /dev/null +++ b/panikombo/migrations/0022_auto_20210326_1324.py @@ -0,0 +1,61 @@ +# Generated by Django 2.2.19 on 2021-03-26 13:24 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('panikombo', '0021_soundscell_tags'), + ] + + operations = [ + migrations.AlterField( + model_name='episodeautoselectioncell', + name='category', + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='emissions.Category' + ), + ), + migrations.AlterField( + model_name='episodeautoselectioncell', + name='page', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='data.Page'), + ), + migrations.AlterField( + model_name='episodecell', + name='episode', + field=models.ForeignKey( + null=True, on_delete=django.db.models.deletion.CASCADE, to='emissions.Episode' + ), + ), + migrations.AlterField( + model_name='episodecell', + name='page', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='data.Page'), + ), + migrations.AlterField( + model_name='itemtopik', + name='page', + field=models.ForeignKey( + blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='data.Page' + ), + ), + migrations.AlterField( + model_name='newsitemautoselectioncell', + name='page', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='data.Page'), + ), + migrations.AlterField( + model_name='soundcell', + name='page', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='data.Page'), + ), + migrations.AlterField( + model_name='soundcell', + name='soundfile', + field=models.ForeignKey( + null=True, on_delete=django.db.models.deletion.CASCADE, to='emissions.SoundFile' + ), + ), + ] diff --git a/panikombo/migrations/0023_auto_20210818_0906.py b/panikombo/migrations/0023_auto_20210818_0906.py new file mode 100644 index 0000000..8f1711f --- /dev/null +++ b/panikombo/migrations/0023_auto_20210818_0906.py @@ -0,0 +1,27 @@ +# Generated by Django 2.2.19 on 2021-08-18 09:06 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('panikombo', '0022_auto_20210326_1324'), + ] + + operations = [ + migrations.AddField( + model_name='episodecell', + name='template_name', + field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Cell Template'), + ), + migrations.AddField( + model_name='soundcell', + name='template_name', + field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Cell Template'), + ), + migrations.AddField( + model_name='soundscell', + name='template_name', + field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Cell Template'), + ), + ] diff --git a/panikombo/migrations/0024_auto_20210818_1158.py b/panikombo/migrations/0024_auto_20210818_1158.py new file mode 100644 index 0000000..d5965c4 --- /dev/null +++ b/panikombo/migrations/0024_auto_20210818_1158.py @@ -0,0 +1,22 @@ +# Generated by Django 2.2.19 on 2021-08-18 11:58 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('panikombo', '0023_auto_20210818_0906'), + ] + + operations = [ + migrations.AddField( + model_name='episodeautoselectioncell', + name='template_name', + field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Cell Template'), + ), + migrations.AddField( + model_name='newsitemautoselectioncell', + name='template_name', + field=models.CharField(blank=True, max_length=50, null=True, verbose_name='Cell Template'), + ), + ] diff --git a/panikombo/migrations/0025_auto_20220714_0830.py b/panikombo/migrations/0025_auto_20220714_0830.py new file mode 100644 index 0000000..137f45a --- /dev/null +++ b/panikombo/migrations/0025_auto_20220714_0830.py @@ -0,0 +1,37 @@ +# Generated by Django 2.2.28 on 2022-07-14 08:30 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('panikombo', '0024_auto_20210818_1158'), + ] + + operations = [ + migrations.AddField( + model_name='episodeautoselectioncell', + name='condition', + field=models.CharField(blank=True, max_length=1000, null=True, verbose_name='Display condition'), + ), + migrations.AddField( + model_name='episodecell', + name='condition', + field=models.CharField(blank=True, max_length=1000, null=True, verbose_name='Display condition'), + ), + migrations.AddField( + model_name='newsitemautoselectioncell', + name='condition', + field=models.CharField(blank=True, max_length=1000, null=True, verbose_name='Display condition'), + ), + migrations.AddField( + model_name='soundcell', + name='condition', + field=models.CharField(blank=True, max_length=1000, null=True, verbose_name='Display condition'), + ), + migrations.AddField( + model_name='soundscell', + name='condition', + field=models.CharField(blank=True, max_length=1000, null=True, verbose_name='Display condition'), + ), + ] diff --git a/panikombo/migrations/0026_auto_20230725_1711.py b/panikombo/migrations/0026_auto_20230725_1711.py new file mode 100644 index 0000000..fd2c7b7 --- /dev/null +++ b/panikombo/migrations/0026_auto_20230725_1711.py @@ -0,0 +1,40 @@ +# Generated by Django 3.2.19 on 2023-07-25 17:11 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('data', '0065_snapshot_uuids'), + ('auth', '0008_alter_user_username_max_length'), + ('panikombo', '0025_auto_20220714_0830'), + ] + + operations = [ + migrations.AlterField( + model_name='episodeautoselectioncell', + name='groups', + field=models.ManyToManyField(blank=True, to='auth.Group', verbose_name='Roles'), + ), + migrations.AlterField( + model_name='episodecell', + name='groups', + field=models.ManyToManyField(blank=True, to='auth.Group', verbose_name='Roles'), + ), + migrations.AlterField( + model_name='newsitemautoselectioncell', + name='groups', + field=models.ManyToManyField(blank=True, to='auth.Group', verbose_name='Roles'), + ), + migrations.AlterField( + model_name='soundcell', + name='groups', + field=models.ManyToManyField(blank=True, to='auth.Group', verbose_name='Roles'), + ), + migrations.AlterField( + model_name='soundscell', + name='groups', + field=models.ManyToManyField(blank=True, to='auth.Group', verbose_name='Roles'), + ), + ] diff --git a/panikombo/migrations/0027_weekprogramcell.py b/panikombo/migrations/0027_weekprogramcell.py new file mode 100644 index 0000000..ecb557f --- /dev/null +++ b/panikombo/migrations/0027_weekprogramcell.py @@ -0,0 +1,55 @@ +# Generated by Django 3.2.19 on 2023-07-25 17:13 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('auth', '0008_alter_user_username_max_length'), + ('data', '0065_snapshot_uuids'), + ('panikombo', '0026_auto_20230725_1711'), + ] + + operations = [ + migrations.CreateModel( + name='WeekProgramCell', + fields=[ + ( + 'id', + models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), + ), + ('placeholder', models.CharField(max_length=20)), + ('order', models.PositiveIntegerField()), + ('slug', models.SlugField(blank=True, verbose_name='Slug')), + ( + 'extra_css_class', + models.CharField( + blank=True, max_length=100, verbose_name='Extra classes for CSS styling' + ), + ), + ( + 'template_name', + models.CharField(blank=True, max_length=50, null=True, verbose_name='Cell Template'), + ), + ( + 'condition', + models.CharField( + blank=True, max_length=1000, null=True, verbose_name='Display condition' + ), + ), + ('public', models.BooleanField(default=True, verbose_name='Public')), + ( + 'restricted_to_unlogged', + models.BooleanField(default=False, verbose_name='Restrict to unlogged users'), + ), + ('last_update_timestamp', models.DateTimeField(auto_now=True)), + ('groups', models.ManyToManyField(blank=True, to='auth.Group', verbose_name='Roles')), + ('page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='data.page')), + ], + options={ + 'abstract': False, + 'verbose_name': 'Week Program', + }, + ), + ] diff --git a/panikombo/migrations/0028_weekprogramcell_include_nonstop.py b/panikombo/migrations/0028_weekprogramcell_include_nonstop.py new file mode 100644 index 0000000..50864c5 --- /dev/null +++ b/panikombo/migrations/0028_weekprogramcell_include_nonstop.py @@ -0,0 +1,17 @@ +# Generated by Django 3.2.19 on 2023-07-25 17:57 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('panikombo', '0027_weekprogramcell'), + ] + + operations = [ + migrations.AddField( + model_name='weekprogramcell', + name='include_nonstop', + field=models.BooleanField(default=True, verbose_name='Include nonstop'), + ), + ] diff --git a/panikombo/migrations/0029_focuscarrouselcell.py b/panikombo/migrations/0029_focuscarrouselcell.py new file mode 100644 index 0000000..afc800f --- /dev/null +++ b/panikombo/migrations/0029_focuscarrouselcell.py @@ -0,0 +1,55 @@ +# Generated by Django 3.2.19 on 2023-07-25 18:24 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('auth', '0008_alter_user_username_max_length'), + ('data', '0065_snapshot_uuids'), + ('panikombo', '0028_weekprogramcell_include_nonstop'), + ] + + operations = [ + migrations.CreateModel( + name='FocusCarrouselCell', + fields=[ + ( + 'id', + models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), + ), + ('placeholder', models.CharField(max_length=20)), + ('order', models.PositiveIntegerField()), + ('slug', models.SlugField(blank=True, verbose_name='Slug')), + ( + 'extra_css_class', + models.CharField( + blank=True, max_length=100, verbose_name='Extra classes for CSS styling' + ), + ), + ( + 'template_name', + models.CharField(blank=True, max_length=50, null=True, verbose_name='Cell Template'), + ), + ( + 'condition', + models.CharField( + blank=True, max_length=1000, null=True, verbose_name='Display condition' + ), + ), + ('public', models.BooleanField(default=True, verbose_name='Public')), + ( + 'restricted_to_unlogged', + models.BooleanField(default=False, verbose_name='Restrict to unlogged users'), + ), + ('last_update_timestamp', models.DateTimeField(auto_now=True)), + ('count', models.PositiveSmallIntegerField(default=3, verbose_name='Count')), + ('groups', models.ManyToManyField(blank=True, to='auth.Group', verbose_name='Roles')), + ('page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='data.page')), + ], + options={ + 'verbose_name': 'Focus carrousel', + }, + ), + ] diff --git a/panikombo/migrations/0030_emissionscell.py b/panikombo/migrations/0030_emissionscell.py new file mode 100644 index 0000000..f7361b5 --- /dev/null +++ b/panikombo/migrations/0030_emissionscell.py @@ -0,0 +1,71 @@ +# Generated by Django 3.2.19 on 2023-07-25 20:23 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('auth', '0008_alter_user_username_max_length'), + ('data', '0065_snapshot_uuids'), + ('panikombo', '0029_focuscarrouselcell'), + ] + + operations = [ + migrations.CreateModel( + name='EmissionsCell', + fields=[ + ( + 'id', + models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID'), + ), + ('placeholder', models.CharField(max_length=20)), + ('order', models.PositiveIntegerField()), + ('slug', models.SlugField(blank=True, verbose_name='Slug')), + ( + 'extra_css_class', + models.CharField( + blank=True, max_length=100, verbose_name='Extra classes for CSS styling' + ), + ), + ( + 'template_name', + models.CharField(blank=True, max_length=50, null=True, verbose_name='Cell Template'), + ), + ( + 'condition', + models.CharField( + blank=True, max_length=1000, null=True, verbose_name='Display condition' + ), + ), + ('public', models.BooleanField(default=True, verbose_name='Public')), + ( + 'restricted_to_unlogged', + models.BooleanField(default=False, verbose_name='Restrict to unlogged users'), + ), + ('last_update_timestamp', models.DateTimeField(auto_now=True)), + ('title', models.CharField(max_length=50, verbose_name='Title', blank=True)), + ('count', models.PositiveSmallIntegerField(default=3, verbose_name='Count')), + ('include_active', models.BooleanField(default=True, verbose_name='Include active')), + ('include_archived', models.BooleanField(default=False, verbose_name='Include archived')), + ( + 'sort_order', + models.CharField( + choices=[ + ('title', 'Alphabetical'), + ('-creation_timestamp', 'Reverse chronological (latest emissions)'), + ('?', 'Random'), + ], + default='-creation_timestamp', + max_length=30, + verbose_name='Sort order', + ), + ), + ('groups', models.ManyToManyField(blank=True, to='auth.Group', verbose_name='Roles')), + ('page', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='data.page')), + ], + options={ + 'verbose_name': 'Emissions', + }, + ), + ] diff --git a/panikombo/migrations/0031_auto_20230902_1801.py b/panikombo/migrations/0031_auto_20230902_1801.py new file mode 100644 index 0000000..96b7fc6 --- /dev/null +++ b/panikombo/migrations/0031_auto_20230902_1801.py @@ -0,0 +1,25 @@ +# Generated by Django 3.2.19 on 2023-09-02 18:01 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('panikombo', '0030_emissionscell'), + ] + + operations = [ + migrations.AlterModelOptions( + name='episodeautoselectioncell', + options={'verbose_name': 'Episodes'}, + ), + migrations.AlterModelOptions( + name='newsitemautoselectioncell', + options={'verbose_name': 'Newsitems'}, + ), + migrations.AddField( + model_name='newsitemautoselectioncell', + name='count', + field=models.PositiveSmallIntegerField(default=20, verbose_name='Count'), + ), + ] diff --git a/panikombo/misc.py b/panikombo/misc.py index 47d5bac..96877ab 100644 --- a/panikombo/misc.py +++ b/panikombo/misc.py @@ -1,39 +1,63 @@ -# coding: utf-8 import collections -COMBO_PUBLIC_TEMPLATES = collections.OrderedDict({ - 'standard': { - 'name': 'Page normale', - 'template': 'combo/page_template_sidebar.html', - 'placeholders': collections.OrderedDict({ - 'introduction': { - 'name': 'Introduction', - 'optional': True, +COMBO_PUBLIC_TEMPLATES = collections.OrderedDict( + { + 'standard': { + 'name': 'Page avec barre latérale', + 'template': 'combo/page_template_sidebar.html', + 'placeholders': collections.OrderedDict( + { + 'introduction': { + 'name': 'Introduction', + 'optional': True, + }, + 'content': { + 'name': 'Contenu', + }, + 'sidebar': { + 'name': 'Barre latérale', + }, + } + ), + }, + 'fullwidth': { + 'name': 'Page prenant toute la largeur', + 'template': 'combo/page_template_full_width.html', + 'placeholders': { + 'introduction': { + 'name': 'Introduction', + 'optional': True, + }, + 'content': { + 'name': 'Contenu', + }, }, - 'content': { - 'name': 'Contenu', + }, + 'standard-about': { + 'name': 'Section « À propos »', + 'template': 'combo/page_template_about.html', + 'placeholders': { + 'content': { + 'name': 'Contenu', + }, }, - 'sidebar': { - 'name': 'Barre latérale', - }, - }) - }, - 'fullwidth': { - 'name': 'Page prenant toute la largeur', - 'template': 'combo/page_template_full_width.html', - 'placeholders': { - 'content': { - 'name': 'Contenu', - }, - } - }, - 'standard-about': { - 'name': 'Section « À propos »', - 'template': 'combo/page_template_about.html', - 'placeholders': { - 'content': { - 'name': 'Contenu', - }, - } - }, -}) + }, + } +) + +COMBO_CELL_TEMPLATES = { + 'data_menucell': { + 'horizontal': { + 'label': 'Horizontal', + 'extra-css-classes': 'menu-horizontal', + }, + 'vertical': { + 'label': 'Vertical', + 'extra-css-classes': 'menu-vertical', + }, + 'topiks': { + 'label': 'Topiks', + 'template': 'cells/menu-topiks.html', + }, + } +} diff --git a/panikombo/models.py b/panikombo/models.py index 58e728a..de99b67 100644 --- a/panikombo/models.py +++ b/panikombo/models.py @@ -1,25 +1,20 @@ -from datetime import date -import os +from datetime import date, datetime, timedelta +from combo.data.library import register_cell_class +from combo.data.models import CellBase from django import template from django.db import models -from django.db.models.functions import Lower -from django.utils.encoding import force_text, python_2_unicode_compatible -from django.utils.translation import ugettext_lazy as _ - -from ckeditor.fields import RichTextField -from taggit.models import Tag +from django.utils.translation import gettext_lazy as _ +from emissions.models import Emission, Episode, Focus, NewsItem, SoundFile +from emissions.utils import period_program from taggit.managers import TaggableManager +from taggit.models import Tag from taggit.utils import parse_tags -from combo.data.models import CellBase -from combo.data.library import register_cell_class - -from emissions.models import Episode, NewsItem, SoundFile @register_cell_class class SoundCell(CellBase): - soundfile = models.ForeignKey('emissions.SoundFile', null=True) + soundfile = models.ForeignKey('emissions.SoundFile', null=True, on_delete=models.CASCADE) class Meta: verbose_name = _('Sound') @@ -31,6 +26,7 @@ class SoundCell(CellBase): def get_default_form_class(self): from .forms import SoundCellForm + return SoundCellForm def get_included_items(self): @@ -41,21 +37,20 @@ class SoundCell(CellBase): def get_additional_label(self): if self.soundfile: if self.soundfile.fragment: - return u'%s - %s - %s' % ( - self.soundfile.episode.emission.title, - self.soundfile.episode.title, - self.soundfile.title) + return '%s - %s - %s' % ( + self.soundfile.episode.emission.title, + self.soundfile.episode.title, + self.soundfile.title, + ) else: - return u'%s - %s' % ( - self.soundfile.episode.emission.title, - self.soundfile.episode.title) + return '%s - %s' % (self.soundfile.episode.emission.title, self.soundfile.episode.title) return '' @register_cell_class class EpisodeCell(CellBase): - episode = models.ForeignKey('emissions.Episode', null=True) + episode = models.ForeignKey('emissions.Episode', null=True, on_delete=models.CASCADE) class Meta: verbose_name = _('Episode') @@ -74,13 +69,12 @@ class EpisodeCell(CellBase): def get_default_form_class(self): from .forms import EpisodeCellForm + return EpisodeCellForm def get_additional_label(self): if self.episode: - return u'%s - %s' % ( - self.episode.emission.title, - self.episode.title) + return '%s - %s' % (self.episode.emission.title, self.episode.title) return '' @@ -94,18 +88,15 @@ class EpisodeAutoSelectionCell(CellBase): title = models.CharField(_('Title'), max_length=50, blank=True) tags = TaggableManager(_('Tags'), blank=True) and_tags = models.CharField(_('And Tags'), max_length=100, blank=True) - category = models.ForeignKey('emissions.Category', null=True, blank=True) + category = models.ForeignKey('emissions.Category', null=True, blank=True, on_delete=models.CASCADE) period = models.PositiveSmallIntegerField( - _('Period'), default=0, - choices=((0, _('All')), - (1, _('Future')), - (2, _('Past')))) - - template_name = 'panikombo/episode_auto_selection.html' + _('Period'), default=0, choices=((0, _('All')), (1, _('Future')), (2, _('Past'))) + ) + default_template_name = 'panikombo/episode_auto_selection.html' class Meta: - verbose_name = _('Automatic Episode Selection') + verbose_name = _('Episodes') def get_included_items(self): episodes_queryset = Episode.objects.select_related() @@ -119,38 +110,53 @@ class EpisodeAutoSelectionCell(CellBase): if self.period == 0: episodes_queryset = episodes_queryset.extra( - select={ 'first_diffusion': 'emissions_diffusion.datetime', }, - select_params=(False, True), - where=['''datetime = (SELECT MIN(datetime) FROM emissions_diffusion - WHERE episode_id = emissions_episode.id)'''], - tables=['emissions_diffusion']) + select={ + 'first_diffusion': 'emissions_diffusion.datetime', + }, + select_params=(False, True), + where=[ + '''datetime = (SELECT MIN(datetime) FROM emissions_diffusion + WHERE episode_id = emissions_episode.id)''' + ], + tables=['emissions_diffusion'], + ) episodes_queryset = episodes_queryset.order_by('first_diffusion').distinct() elif self.period == 1: episodes_queryset = episodes_queryset.extra( - select={ 'first_diffusion': 'emissions_diffusion.datetime', }, - select_params=(False, True), - where=['''datetime = (SELECT MIN(datetime) FROM emissions_diffusion + select={ + 'first_diffusion': 'emissions_diffusion.datetime', + }, + select_params=(False, True), + where=[ + '''datetime = (SELECT MIN(datetime) FROM emissions_diffusion WHERE episode_id = emissions_episode.id) AND - datetime >= CURRENT_TIMESTAMP'''], - tables=['emissions_diffusion']) + datetime >= CURRENT_TIMESTAMP''' + ], + tables=['emissions_diffusion'], + ) episodes_queryset = episodes_queryset.order_by('-first_diffusion').distinct() elif self.period == 2: episodes_queryset = episodes_queryset.extra( - select={ 'first_diffusion': 'emissions_diffusion.datetime', }, - select_params=(False, True), - where=['''datetime = (SELECT MIN(datetime) FROM emissions_diffusion + select={ + 'first_diffusion': 'emissions_diffusion.datetime', + }, + select_params=(False, True), + where=[ + '''datetime = (SELECT MIN(datetime) FROM emissions_diffusion WHERE episode_id = emissions_episode.id) AND - datetime < CURRENT_TIMESTAMP'''], - tables=['emissions_diffusion']) + datetime < CURRENT_TIMESTAMP''' + ], + tables=['emissions_diffusion'], + ) episodes_queryset = episodes_queryset.order_by('-first_diffusion').distinct() return episodes_queryset def get_cell_extra_context(self, context): - ctx = super(EpisodeAutoSelectionCell, self).get_cell_extra_context(context) + ctx = super().get_cell_extra_context(context) ctx['title'] = self.title - if (self.category or self.period or self.tags.count()): + if self.category or self.period or self.tags.count(): ctx['episodes'] = self.get_included_items() else: ctx['episodes'] = [] @@ -159,6 +165,7 @@ class EpisodeAutoSelectionCell(CellBase): def get_default_form_class(self): from .forms import EpisodeAutoSelectionCellForm + return EpisodeAutoSelectionCellForm def get_additional_label(self): @@ -166,19 +173,22 @@ class EpisodeAutoSelectionCell(CellBase): return self.title return '' + @register_cell_class class NewsItemAutoSelectionCell(CellBase): title = models.CharField(_('Title'), max_length=50, blank=True) tags = TaggableManager(_('Tags'), blank=True) and_tags = models.CharField(_('And Tags'), max_length=100, blank=True) future = models.BooleanField(_('Future Events Only'), default=True) - category = models.ForeignKey('emissions.NewsCategory', - verbose_name=_('Category'), null=True, blank=True) + category = models.ForeignKey( + 'emissions.NewsCategory', verbose_name=_('Category'), null=True, blank=True, on_delete=models.SET_NULL + ) + count = models.PositiveSmallIntegerField(_('Count'), default=20) - template_name = 'panikombo/newsitem_auto_selection.html' + default_template_name = 'panikombo/newsitem_auto_selection.html' class Meta: - verbose_name = _('Automatic Newsitem Selection') + verbose_name = _('Newsitems') def get_included_items(self): newsitems_queryset = NewsItem.objects.select_related() @@ -192,21 +202,17 @@ class NewsItemAutoSelectionCell(CellBase): if self.category: newsitems_queryset = newsitems_queryset.filter(category=self.category) newsitems_queryset = newsitems_queryset.order_by('-event_date', '-creation_timestamp') - return newsitems_queryset + return newsitems_queryset[: self.count] def get_cell_extra_context(self, context): - ctx = super(NewsItemAutoSelectionCell, self).get_cell_extra_context(context) + ctx = super().get_cell_extra_context(context) ctx['title'] = self.title - - if self.tags.count() or self.future or self.category: - ctx['newsitems'] = self.get_included_items() - else: - ctx['newsitems'] = [] - + ctx['newsitems'] = self.get_included_items() return ctx def get_default_form_class(self): from .forms import NewsItemAutoSelectionCellForm + return NewsItemAutoSelectionCellForm def get_additional_label(self): @@ -216,11 +222,13 @@ class NewsItemAutoSelectionCell(CellBase): class ItemTopik(models.Model): - newsitem = models.ForeignKey('emissions.NewsItem', verbose_name=_('News Item'), - null=True, blank=True) - episode = models.ForeignKey('emissions.Episode', verbose_name=_('Episode'), - null=True, blank=True) - page = models.ForeignKey('data.Page', null=True, blank=True) + newsitem = models.ForeignKey( + 'emissions.NewsItem', verbose_name=_('News Item'), null=True, blank=True, on_delete=models.SET_NULL + ) + episode = models.ForeignKey( + 'emissions.Episode', verbose_name=_('Episode'), null=True, blank=True, on_delete=models.SET_NULL + ) + page = models.ForeignKey('data.Page', null=True, blank=True, on_delete=models.SET_NULL) @register_cell_class @@ -229,26 +237,29 @@ class SoundsCell(CellBase): include_search_input = models.BooleanField(_('Include search input'), default=True) include_fragments = models.BooleanField(_('Include fragments'), default=True) limit_to_focus = models.BooleanField(_('Limit to focused elements'), default=False) - sound_format = models.ForeignKey('emissions.Format', - verbose_name=_('Limit to format'), null=True, blank=True) + sound_format = models.ForeignKey( + 'emissions.Format', verbose_name=_('Limit to format'), null=True, blank=True, on_delete=models.CASCADE + ) tags = TaggableManager(_('Tags'), blank=True) minimal_duration = models.PositiveIntegerField( - _('Minimal duration (in minutes)'), - default=None, blank=True, null=True) + _('Minimal duration (in minutes)'), default=None, blank=True, null=True + ) maximal_duration = models.PositiveIntegerField( - _('Maximal duration (in minutes)'), - default=None, blank=True, null=True) + _('Maximal duration (in minutes)'), default=None, blank=True, null=True + ) count = models.PositiveSmallIntegerField(_('Count'), default=20) - sort_order = models.CharField(_('Sort order'), default='-creation_timestamp', - max_length=30, - choices=[ - ('-creation_timestamp', _('Reverse chronological (creation)')), - ('-first_diffusion', _('Reverse chronological (diffusion)')), - ('creation_timestamp', _('Chronological (creation)')), - ('first_diffusion', _('Chronological (diffusion)')), - ('?', _('Random')), - ] - ) + sort_order = models.CharField( + _('Sort order'), + default='-creation_timestamp', + max_length=30, + choices=[ + ('-creation_timestamp', _('Reverse chronological (creation)')), + ('-first_diffusion', _('Reverse chronological (diffusion)')), + ('creation_timestamp', _('Chronological (creation)')), + ('first_diffusion', _('Chronological (diffusion)')), + ('?', _('Random')), + ], + ) class Meta: verbose_name = _('Sounds') @@ -261,6 +272,7 @@ class SoundsCell(CellBase): def get_cell_extra_context(self, context): soundfiles = SoundFile.objects.prefetch_related('episode__emission__categories') soundfiles = soundfiles.filter(podcastable=True) + soundfiles = soundfiles.exclude(creation_timestamp__isnull=True) if not self.include_fragments: soundfiles = soundfiles.filter(fragment=False) if self.limit_to_focus: @@ -273,14 +285,142 @@ class SoundsCell(CellBase): soundfiles = soundfiles.filter(duration__lte=self.maximal_duration * 60) if self.tags.exists(): soundfiles = soundfiles.filter(episode__tags__in=self.tags.all()) - soundfiles = soundfiles.select_related().extra( - select={'first_diffusion': 'emissions_diffusion.datetime', }, - select_params=(False, True), - where=['''datetime = (SELECT MIN(datetime) + soundfiles = ( + soundfiles.select_related() + .extra( + select={ + 'first_diffusion': 'emissions_diffusion.datetime', + }, + select_params=(False, True), + where=[ + '''datetime = (SELECT MIN(datetime) FROM emissions_diffusion - WHERE episode_id = emissions_episode.id)'''], - tables=['emissions_diffusion'],).order_by(self.sort_order).distinct() + WHERE episode_id = emissions_episode.id)''' + ], + tables=['emissions_diffusion'], + ) + .order_by(self.sort_order) + .distinct() + ) return { 'include_search_input': self.include_search_input, - 'soundfiles': soundfiles[:self.count], + 'soundfiles': soundfiles[: self.count], } + + +@register_cell_class +class WeekProgramCell(CellBase): + include_nonstop = models.BooleanField(_('Include nonstop'), default=True) + + default_template_name = 'panikombo/week_program.html' + + class Meta: + verbose_name = _('Week Program') + + @staticmethod + def tofirstdayinisoweek(year, week): + # from http://stackoverflow.com/questions/5882405/get-date-from-iso-week-number-in-python + ret = datetime.strptime('%04d-%02d-1' % (year, week), '%Y-%W-%w') + if datetime(year, 1, 4).isoweekday() > 4: + ret -= timedelta(days=7) + return ret + + def get_cell_extra_context(self, context): + ctx = super().get_cell_extra_context(context) + year = context['request'].GET.get('year') if 'request' in context else None + week = context['request'].GET.get('week') if 'request' in context else None + weekday = context['request'].GET.get('weekday') if 'request' in context else None + year = int(year if year else datetime.today().isocalendar()[0]) + week = int(week if week else datetime.today().isocalendar()[1]) + weekday = int(weekday if weekday is not None else datetime.today().weekday()) + + date = WeekProgramCell.tofirstdayinisoweek(year, week) + date = datetime(*date.timetuple()[:3]) + + previous_week = date - timedelta(days=7) + previous_week_year, previous_week_no = previous_week.isocalendar()[:2] + + next_week = date + timedelta(days=7) + next_week_year, next_week_no = next_week.isocalendar()[:2] + + program = period_program(date, date + timedelta(days=7), include_nonstop=self.include_nonstop) + days = [] + for day in range(7): + days.append( + { + 'cells': [x for x in program if x.is_on_weekday(day + 1)], + 'datetime': date + timedelta(days=day), + } + ) + + ctx.update( + { + 'days': days, + 'weekday': weekday, + 'week': week, + 'year': year, + 'previous_week_year': previous_week_year, + 'previous_week_no': previous_week_no, + 'next_week_year': next_week_year, + 'next_week_no': next_week_no, + } + ) + + return ctx + + +@register_cell_class +class FocusCarrouselCell(CellBase): + count = models.PositiveSmallIntegerField(_('Count'), default=3) + + default_template_name = 'panikombo/focus_carrousel.html' + + class Meta: + verbose_name = _('Focus carrousel') + + def get_cell_extra_context(self, context): + ctx = super().get_cell_extra_context(context) + ctx['news'] = ( + Focus.objects.filter(current=True) + .select_related('emission', 'newsitem', 'soundfile', 'episode', 'newsitem__category') + .order_by('?')[: self.count] + ) + return ctx + + +@register_cell_class +class EmissionsCell(CellBase): + title = models.CharField(_('Title'), max_length=50, blank=True) + count = models.PositiveSmallIntegerField(_('Count'), default=3) + include_active = models.BooleanField(_('Include active'), default=True) + include_archived = models.BooleanField(_('Include archived'), default=False) + sort_order = models.CharField( + _('Sort order'), + default='-creation_timestamp', + max_length=30, + choices=[ + ('title', _('Alphabetical')), + ('-creation_timestamp', _('Reverse chronological (latest emissions)')), + ('?', _('Random')), + ], + ) + + default_template_name = 'panikombo/emissions.html' + + class Meta: + verbose_name = _('Emissions') + + def get_cell_extra_context(self, context): + ctx = super().get_cell_extra_context(context) + + qs = Emission.objects.all() + if not self.include_active: + qs = qs.exclude(archived=False) + if not self.include_archived: + qs = qs.exclude(archived=True) + + qs = qs.order_by(self.sort_order) + + ctx['emissions'] = qs[: self.count] + + return ctx diff --git a/panikombo/templates/panikombo/audio.html b/panikombo/templates/panikombo/audio.html new file mode 100644 index 0000000..074e369 --- /dev/null +++ b/panikombo/templates/panikombo/audio.html @@ -0,0 +1,27 @@ +{% load paniktags thumbnail static %} +{% if soundfile %} +
+ + +
+{% endif %} diff --git a/panikombo/templates/panikombo/emissions.html b/panikombo/templates/panikombo/emissions.html new file mode 100644 index 0000000..680e373 --- /dev/null +++ b/panikombo/templates/panikombo/emissions.html @@ -0,0 +1,11 @@ +{% load i18n paniktags %} +{% if cell.title %} +

{{ cell.title }}

+{% endif %} + diff --git a/panikombo/templates/panikombo/episode.html b/panikombo/templates/panikombo/episode.html new file mode 100644 index 0000000..3335fb8 --- /dev/null +++ b/panikombo/templates/panikombo/episode.html @@ -0,0 +1,31 @@ +{% load paniktags thumbnail static %} +{% if episode %} +
+ +
    +
  • +
    + {{ episode.emission.title }} - + {{ episode.title }} + {% if soundfile.fragment %} - {{ soundfile.title }}{% endif %} +
    + {% for diffusion in episode.diffusions %} + → {{ diffusion.datetime|date:"l d M Y à H:i" }} + {% endfor %} + {% if soundfile %}{% audio sound=soundfile %}{% endif %} +
  • +
+
+{% endif %} diff --git a/panikombo/templates/panikombo/episode_auto_selection.html b/panikombo/templates/panikombo/episode_auto_selection.html new file mode 100644 index 0000000..657c59f --- /dev/null +++ b/panikombo/templates/panikombo/episode_auto_selection.html @@ -0,0 +1,39 @@ +{% load paniktags thumbnail static %} +{% if title and episodes %}

{{title}}

{% endif %} +{% for episode in episodes %} + +
+ +
    +
  • + + {% for diffusion in episode.diffusions %} + → {{ diffusion.datetime|date:"l d M Y à H:i" }} + {% endfor %} + {% if episode.main_sound %}{% audio sound=episode.main_sound %}{% endif %} + {% for sound in episode.fragment_sounds %} +
    + {% audio sound=sound display_fragment_name=True %} +
    + {% endfor %} +
  • +
+
+ +{% endfor %} diff --git a/panikombo/templates/panikombo/episodeautoselectioncell_form.html b/panikombo/templates/panikombo/episodeautoselectioncell_form.html new file mode 100644 index 0000000..572164d --- /dev/null +++ b/panikombo/templates/panikombo/episodeautoselectioncell_form.html @@ -0,0 +1 @@ +{{form.as_p}} diff --git a/panikombo/templates/panikombo/focus_carrousel.html b/panikombo/templates/panikombo/focus_carrousel.html new file mode 100644 index 0000000..0eff3d6 --- /dev/null +++ b/panikombo/templates/panikombo/focus_carrousel.html @@ -0,0 +1,40 @@ +{% load thumbnail i18n paniktags %} +
+
+ +
+
    + {% for focus in news %} +
  • + +
  • + {% endfor %} +
+
+
+
diff --git a/panikombo/templates/panikombo/newsitem_auto_selection.html b/panikombo/templates/panikombo/newsitem_auto_selection.html new file mode 100644 index 0000000..d6fb769 --- /dev/null +++ b/panikombo/templates/panikombo/newsitem_auto_selection.html @@ -0,0 +1,7 @@ +{% load paniktags %} +{% if title and newsitems %}

{{title}}

{% endif %} + diff --git a/panikombo/templates/panikombo/select2.html b/panikombo/templates/panikombo/select2.html index 4137d9a..01d1766 100644 --- a/panikombo/templates/panikombo/select2.html +++ b/panikombo/templates/panikombo/select2.html @@ -1,8 +1,8 @@ diff --git a/panikombo/templates/panikombo/week_program.html b/panikombo/templates/panikombo/week_program.html new file mode 100644 index 0000000..a174966 --- /dev/null +++ b/panikombo/templates/panikombo/week_program.html @@ -0,0 +1,74 @@ +{% load i18n paniktags static %} + +{% block program-header %} +
+ +
+{% endblock %} + +{% block program-content %} +
+ + {% for day in days %} +
+
    + {% for cell in day.cells %} +
  • + {% block week-program-line %} +
    {{ cell.datetime|date:"H:i" }}
    +
    + {% if cell.episode %} + {% with cell.episode as episode %}{% episode_resume model="inline" klass="standalone" date=False %}{% endwith %} + {% elif cell.emission %} + {% with cell.emission as emission %}{% emission_resume %}{% endwith %} + {% else %} + {{ cell.label }} - Musique en continu - playlist + {% endif %} +
    + {% endblock %} +
  • + {% empty %} +
  • {% block week-program-empty %}
    Non stop only!
    {% endblock %}
  • + {% endfor %} +
+
+ {% endfor %} +
+{% endblock %} + +{% block scripts %} + + +{% endblock %} diff --git a/panikombo/urls.py b/panikombo/urls.py index 90cf91e..d44f2ef 100644 --- a/panikombo/urls.py +++ b/panikombo/urls.py @@ -1,8 +1,8 @@ -from django.conf.urls import url +from django.urls import path from . import views urlpatterns = [ - url(r'^select2/episodes/$', views.episodes, name='panikombo-select2-episodes'), - url(r'^select2/soundfiles/$', views.soundfiles, name='panikombo-select2-soundfiles'), + path('select2/episodes/', views.episodes, name='panikombo-select2-episodes'), + path('select2/soundfiles/', views.soundfiles, name='panikombo-select2-soundfiles'), ] diff --git a/panikombo/views.py b/panikombo/views.py index e2c2ac2..4775292 100644 --- a/panikombo/views.py +++ b/panikombo/views.py @@ -1,8 +1,7 @@ from django.contrib.auth.decorators import login_required from django.db.models import Q from django.http import JsonResponse - -from emissions.models import SoundFile, Episode +from emissions.models import Episode, SoundFile @login_required diff --git a/setup.py b/setup.py index fc90cfc..423f83f 100644 --- a/setup.py +++ b/setup.py @@ -3,12 +3,12 @@ import os import subprocess import sys - -from setuptools.command.install_lib import install_lib as _install_lib +from distutils.cmd import Command from distutils.command.build import build as _build from distutils.command.sdist import sdist as _sdist -from distutils.cmd import Command -from setuptools import setup, find_packages + +from setuptools import find_packages, setup +from setuptools.command.install_lib import install_lib as _install_lib class sdist(_sdist): @@ -25,11 +25,14 @@ class sdist(_sdist): def get_version(): if os.path.exists('VERSION'): - with open('VERSION', 'r') as v: + with open('VERSION') as v: return v.read() if os.path.exists('.git'): - p = subprocess.Popen(['git', 'describe', '--dirty=.dirty', '--match=v*'], - stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.Popen( + ['git', 'describe', '--dirty=.dirty', '--match=v*'], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) result = p.communicate()[0] if p.returncode == 0: result = result.decode('ascii').strip()[1:] # strip spaces/newlines and initial v @@ -40,9 +43,7 @@ def get_version(): version = result return version else: - return '0.0.post%s' % len( - subprocess.check_output( - ['git', 'rev-list', 'HEAD']).splitlines()) + return '0.0.post%s' % len(subprocess.check_output(['git', 'rev-list', 'HEAD']).splitlines()) return '0.0' @@ -59,6 +60,7 @@ class compile_translations(Command): def run(self): try: from django.core.management import call_command + for path, dirs, files in os.walk('panikombo'): if 'locale' not in dirs: continue @@ -106,5 +108,5 @@ setup( 'compile_translations': compile_translations, 'install_lib': install_lib, 'sdist': sdist, - } + }, )