diff --git a/entrypoint.sh b/entrypoint.sh index 50b05fe..ed17c5f 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -13,8 +13,6 @@ sleep 2 python manage.py migrate python manage.py collectstatic --no-input -python manage.py runserver 0.0.0.0:8000 - # harakiri parameter respawns processes taking more than 20 seconds # max-requests parameter respawns processes after serving 5000 requests # vacuum parameter cleans up when stopped diff --git a/media/admin.py b/media/admin.py index e679f91..f4e2d56 100644 --- a/media/admin.py +++ b/media/admin.py @@ -9,7 +9,7 @@ from reversion.admin import VersionAdmin from med.admin import admin_site from .forms import MediaAdminForm -from .models import Auteur, Emprunt, FutureMedia, Jeu, Media, Manga +from .models import Auteur, Emprunt, FutureMedia, Jeu, Manga, Media class AuteurAdmin(VersionAdmin): diff --git a/media/forms.py b/media/forms.py index 0d9b0e4..f368974 100644 --- a/media/forms.py +++ b/media/forms.py @@ -70,7 +70,8 @@ class MediaAdminForm(ModelForm): if 'publishedDate' in info: self.cleaned_data['publish_date'] = info['publishedDate'] - if 'authors' not in self.cleaned_data or not self.cleaned_data['authors']: + if 'authors' not in self.cleaned_data \ + or not self.cleaned_data['authors']: self.cleaned_data['authors'] = list() if 'authors' in info: @@ -143,7 +144,8 @@ class MediaAdminForm(ModelForm): .format(split[2], months.index(split[0]) + 1, int(split[1]), ) - if 'authors' not in self.cleaned_data or not self.cleaned_data['authors']: + if 'authors' not in self.cleaned_data \ + or not self.cleaned_data['authors']: self.cleaned_data['authors'] = list() if 'authors' in data: diff --git a/media/management/commands/split_media_types.py b/media/management/commands/split_media_types.py index 7e30a8a..b5d7d3c 100644 --- a/media/management/commands/split_media_types.py +++ b/media/management/commands/split_media_types.py @@ -1,7 +1,7 @@ from django.core.management import BaseCommand from media.forms import MediaAdminForm -from media.models import Media, Manga +from media.models import Manga, Media class Command(BaseCommand): @@ -15,11 +15,13 @@ class Command(BaseCommand): for media in Media.objects.all(): self.stdout.write(str(media)) - form = MediaAdminForm(instance=media, data={"isbn": media.isbn, "_isbn": True, }) + form = MediaAdminForm(instance=media, + data={"isbn": media.isbn, "_isbn": True, }) form.full_clean() - if not "format" in form.cleaned_data: - self.stdout.write("Format not specified. Assume it is a comic strip.") + if "format" not in form.cleaned_data: + self.stdout.write("Format not specified." + " Assume it is a comic strip.") continue format = form.cleaned_data["format"] @@ -27,7 +29,9 @@ class Command(BaseCommand): if not options["view_only"]: if format == "manga": - self.stdout.write(self.style.WARNING("This media is a manga. Transfer it into a new object...")) + self.stdout.write(self.style.WARNING( + "This media is a manga. " + "Transfer it into a new object...")) manga = Manga.objects.create( isbn=media.isbn, title=media.title, @@ -41,10 +45,12 @@ class Command(BaseCommand): manga.authors.set(media.authors.all()) manga.save() - self.stdout.write(self.style.SUCCESS("Manga successfully saved. Deleting old medium...")) + self.stdout.write(self.style.SUCCESS( + "Manga successfully saved. Deleting old medium...")) media.delete() self.stdout.write(self.style.SUCCESS("Medium deleted")) converted += 1 - self.stdout.write(self.style.SUCCESS("Successfully saved {:d} mangas".format(converted))) + self.stdout.write(self.style.SUCCESS( + "Successfully saved {:d} mangas".format(converted))) diff --git a/media/migrations/0029_auto_20200521_1659.py b/media/migrations/0029_auto_20200521_1659.py new file mode 100644 index 0000000..374eff4 --- /dev/null +++ b/media/migrations/0029_auto_20200521_1659.py @@ -0,0 +1,17 @@ +# Generated by Django 2.2.10 on 2020-05-21 14:59 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('media', '0028_manga'), + ] + + operations = [ + migrations.AlterModelOptions( + name='manga', + options={'ordering': ['title', 'subtitle'], 'verbose_name': 'manga', 'verbose_name_plural': 'mangas'}, + ), + ]