diff --git a/profile/migrations/0001_initial.py b/profile/migrations/0001_initial.py index cf221f507e56f33406dcb118baed4df5d2d1e33a..ad7c45b8559e5f0f484406bfd52958667e21d2cc 100644 --- a/profile/migrations/0001_initial.py +++ b/profile/migrations/0001_initial.py @@ -2,10 +2,11 @@ # Generated by Django 1.11.3 on 2017-11-09 18:42 from __future__ import unicode_literals +import versatileimagefield.fields + +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion -import versatileimagefield.fields class Migration(migrations.Migration): diff --git a/profile/migrations/0001_squashed.py b/profile/migrations/0001_squashed.py index 50f9e213819275b1cef01be96bd42094bfff8e99..1313caa100beedfb221a769bf81943e0f62e0541 100644 --- a/profile/migrations/0001_squashed.py +++ b/profile/migrations/0001_squashed.py @@ -1,8 +1,8 @@ # Generated by Django 2.2.12 on 2020-11-21 01:34 +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion class Migration(migrations.Migration): @@ -37,7 +37,7 @@ class Migration(migrations.Migration): models.CharField( blank=True, help_text="Your username in CBA. This is necessary for uploading files to" - " your account.", + " your account.", max_length=60, verbose_name="CBA Username", ), @@ -47,7 +47,7 @@ class Migration(migrations.Migration): models.CharField( blank=True, help_text="The CBA upload token for your account. This is NOT your" - " password which you use to log into CBA!", + " password which you use to log into CBA!", max_length=255, verbose_name="CBA Token", ), diff --git a/profile/migrations/0002_auto_20171129_1828.py b/profile/migrations/0002_auto_20171129_1828.py index 1f30c9a009497a5f0278403137b675c57af3cccc..389554246f612dd8ce7674c8f2e7722fac746b21 100644 --- a/profile/migrations/0002_auto_20171129_1828.py +++ b/profile/migrations/0002_auto_20171129_1828.py @@ -2,10 +2,11 @@ # Generated by Django 1.11.3 on 2017-11-29 18:28 from __future__ import unicode_literals +import versatileimagefield.fields + +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion -import versatileimagefield.fields class Migration(migrations.Migration): @@ -38,7 +39,7 @@ class Migration(migrations.Migration): field=models.CharField( blank=True, help_text="The CBA upload token for your account. This is NOT your password which" - " you use to log into CBA!", + " you use to log into CBA!", max_length=255, verbose_name="CBA Token", ), @@ -49,7 +50,7 @@ class Migration(migrations.Migration): field=models.CharField( blank=True, help_text="Your username in CBA. This is necessary for uploading files to your" - " account.", + " account.", max_length=60, verbose_name="CBA Username", ), @@ -88,8 +89,8 @@ class Migration(migrations.Migration): blank=True, height_field="height", help_text="Upload a picture of yourself. Images are automatically cropped around" - " the 'Primary Point of Interest'. Click in the image to change it and" - " press Save.", + " the 'Primary Point of Interest'. Click in the image to change it and" + " press Save.", null=True, upload_to="user_images", verbose_name="Profile picture", diff --git a/profile/serializers.py b/profile/serializers.py index dd06250e6038b7395f4e5fed0d32ce383e203d44..efff1c2f0ee98b5b086d3c5fa069cd8869a3b72c 100644 --- a/profile/serializers.py +++ b/profile/serializers.py @@ -17,10 +17,10 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -from rest_framework import serializers - from profile.models import Profile +from rest_framework import serializers + class ProfileSerializer(serializers.ModelSerializer): class Meta: diff --git a/program/auth.py b/program/auth.py index 17221ae5e93441891efd235cd04a765450babb1e..19d2b99756e835716636361c96bcf9b7457556a1 100644 --- a/program/auth.py +++ b/program/auth.py @@ -20,8 +20,7 @@ from oidc_provider.lib.utils.oauth2 import extract_access_token from oidc_provider.models import Token -from rest_framework import authentication -from rest_framework import exceptions +from rest_framework import authentication, exceptions class OidcOauth2Auth(authentication.BaseAuthentication): diff --git a/program/management/commands/addnote.py b/program/management/commands/addnote.py index d78ec535c5fbb24a27f499089201d44bb300dc8b..e19ede8d7bd530c66919cb3a3daf76c1f33a809e 100644 --- a/program/management/commands/addnote.py +++ b/program/management/commands/addnote.py @@ -1,9 +1,8 @@ -from django.core.management.base import BaseCommand, CommandError -from django.core.exceptions import ValidationError - import sys -from program.models import Show, TimeSlot, Note +from django.core.exceptions import ValidationError +from django.core.management.base import BaseCommand, CommandError +from program.models import Note, Show, TimeSlot from program.utils import parse_date diff --git a/program/management/commands/create_oidc_client.py b/program/management/commands/create_oidc_client.py index 46d3d2b19aa5517ba67a167ed26afc99fc33eba1..b7c247daa912708be70b471ba000315f7eb55031 100644 --- a/program/management/commands/create_oidc_client.py +++ b/program/management/commands/create_oidc_client.py @@ -2,9 +2,10 @@ import random import string import sys -from django.core.management.base import BaseCommand, CommandError from oidc_provider.models import Client, ResponseType +from django.core.management.base import BaseCommand, CommandError + class Command(BaseCommand): help = ( @@ -49,7 +50,7 @@ class Command(BaseCommand): dest="reuse_consent", action="store_false", help="By default user consent will be reused. Use this if the user should provide" - " consent on every login.", + " consent on every login.", ) parser.set_defaults(require_consent=True, reuse_consent=True) parser.add_argument( diff --git a/program/management/commands/export_showlog.py b/program/management/commands/export_showlog.py index 0cf4ca0d53d36891c680d651782681b85f568b1b..df471d48bcfce5e3ee427552b60c3ce2f290d5c0 100644 --- a/program/management/commands/export_showlog.py +++ b/program/management/commands/export_showlog.py @@ -3,6 +3,7 @@ import codecs import sys from datetime import datetime + from django.core.management.base import BaseCommand, CommandError from program.models import TimeSlot diff --git a/program/management/commands/remove_automation_id.py b/program/management/commands/remove_automation_id.py index 6045ff23aa433ab5c3e45a62d4104e6fef1cc0d4..519e768150099a1bb958a0b8762293d55e749f08 100644 --- a/program/management/commands/remove_automation_id.py +++ b/program/management/commands/remove_automation_id.py @@ -1,5 +1,4 @@ from django.core.management.base import BaseCommand, CommandError - from program.models import Schedule diff --git a/program/migrations/0001_initial.py b/program/migrations/0001_initial.py index 7a93e423d159d381688c743fd953702a889ef14d..34b3079b0c61d6b690249c289cc87a381d623dac 100644 --- a/program/migrations/0001_initial.py +++ b/program/migrations/0001_initial.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import migrations, models from django.conf import settings +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/program/migrations/0001_squashed.py b/program/migrations/0001_squashed.py index a231524b4b990776d05cbd5058a13321b62767e1..4a3a39fee7a4045ce858a8fb567a09f20666491e 100644 --- a/program/migrations/0001_squashed.py +++ b/program/migrations/0001_squashed.py @@ -1,9 +1,10 @@ # Generated by Django 2.2.12 on 2020-11-21 01:34 +import versatileimagefield.fields + +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion -import versatileimagefield.fields class Migration(migrations.Migration): @@ -72,7 +73,7 @@ class Migration(migrations.Migration): models.TextField( blank=True, help_text="Describe yourself and your fields of interest in a few" - " sentences.", + " sentences.", null=True, verbose_name="Biography", ), @@ -124,8 +125,8 @@ class Migration(migrations.Migration): blank=True, height_field="height", help_text="Upload a picture of yourself. Images are automatically cropped" - " around the 'Primary Point of Interest'. Click in the image to" - " change it and press Save.", + " around the 'Primary Point of Interest'. Click in the image to" + " change it and press Save.", null=True, upload_to="host_images", verbose_name="Profile picture", @@ -332,8 +333,8 @@ class Migration(migrations.Migration): blank=True, height_field="height", help_text="Upload an image to your show. Images are automatically cropped" - " around the 'Primary Point of Interest'. Click in the image to" - " change it and press Save.", + " around the 'Primary Point of Interest'. Click in the image to" + " change it and press Save.", null=True, upload_to="show_images", verbose_name="Image", @@ -344,8 +345,8 @@ class Migration(migrations.Migration): "short_description", models.TextField( help_text="Describe your show in some sentences. Avoid technical data like" - " airing times and contact information. They will be added" - " automatically.", + " airing times and contact information. They will be added" + " automatically.", verbose_name="Short description", ), ), @@ -422,9 +423,9 @@ class Migration(migrations.Migration): models.IntegerField( blank=True, help_text="Link your show to a CBA series by giving its ID. This will" - " enable CBA upload and will automatically link your show to" - " your CBA archive. Find out your ID under" - " https://cba.fro.at/series", + " enable CBA upload and will automatically link your show to" + " your CBA archive. Find out your ID under" + " https://cba.fro.at/series", null=True, verbose_name="CBA Series ID", ), @@ -811,9 +812,9 @@ class Migration(migrations.Migration): "title", models.CharField( help_text="Give your note a good headline. What will your upcoming show be" - " about? Try to arouse interest to listen to it!<br>Avoid" - " technical data like the show's name, its airing times or its" - " episode number. These data are added automatically.", + " about? Try to arouse interest to listen to it!<br>Avoid" + " technical data like the show's name, its airing times or its" + " episode number. These data are added automatically.", max_length=128, verbose_name="Title", ), @@ -869,8 +870,8 @@ class Migration(migrations.Migration): models.IntegerField( blank=True, help_text="Link the note to a certain CBA post by giving its ID. (E.g. if" - " your post's CBA URL is https://cba.fro.at/1234, then your CBA" - " ID is 1234)", + " your post's CBA URL is https://cba.fro.at/1234, then your CBA" + " ID is 1234)", null=True, verbose_name="CBA ID", ), @@ -899,8 +900,8 @@ class Migration(migrations.Migration): blank=True, height_field="height", help_text="Upload an image to your note. Images are automatically cropped" - " around the 'Primary Point of Interest'. Click in the image to" - " change it and press Save.", + " around the 'Primary Point of Interest'. Click in the image to" + " change it and press Save.", null=True, upload_to="note_images", verbose_name="Featured image", @@ -931,8 +932,8 @@ class Migration(migrations.Migration): models.TextField( blank=True, help_text="Describe your upcoming show in some sentences. Avoid technical" - " data like airing times and contact information. They will be" - " added automatically.", + " data like airing times and contact information. They will be" + " added automatically.", verbose_name="Summary", ), ), @@ -1076,8 +1077,8 @@ class Migration(migrations.Migration): field=models.IntegerField( blank=True, help_text="Link your show to a CBA series by giving its ID. This will enable CBA" - " upload and will automatically link your show to your CBA archive. Find" - " out your show's ID under https://cba.fro.at/series", + " upload and will automatically link your show to your CBA archive. Find" + " out your show's ID under https://cba.fro.at/series", null=True, verbose_name="CBA Series ID", ), @@ -1088,7 +1089,7 @@ class Migration(migrations.Migration): field=models.IntegerField( blank=True, help_text="If a timeslot of your show is empty, this playlist will be aired as a" - " backup.", + " backup.", null=True, verbose_name="Fallback ID", ), @@ -1109,8 +1110,8 @@ class Migration(migrations.Migration): name="short_description", field=models.TextField( help_text="Describe your show for your listeners in some sentences. Avoid" - " technical data like airing times and contact information. They will be" - " added automatically.", + " technical data like airing times and contact information. They will be" + " added automatically.", verbose_name="Short description", ), ), @@ -1137,7 +1138,7 @@ class Migration(migrations.Migration): field=models.BooleanField( default=False, help_text="Files and Playlists of Public Shows can only be changed by owners but" - " may be used by everyone.", + " may be used by everyone.", verbose_name="Is Public?", ), ), diff --git a/program/migrations/0004_auto_20220111_1806.py b/program/migrations/0004_auto_20220111_1806.py index cb6e547ba1f6b0aa1282d36c0d957c8b7d898803..17cf8ad1f3d09ffad4f6c0821e67000b8e744b2c 100644 --- a/program/migrations/0004_auto_20220111_1806.py +++ b/program/migrations/0004_auto_20220111_1806.py @@ -69,7 +69,7 @@ class Migration(migrations.Migration): field=models.IntegerField( blank=True, help_text="If a timeslot of your show is empty, this playlist will be aired as a" - " backup.", + " backup.", null=True, verbose_name="Default Playlist ID", ), diff --git a/program/migrations/0008_auto_20220117_1721.py b/program/migrations/0008_auto_20220117_1721.py index d5f39e87907759b04bc03c5861ee25b8ff510f01..6009f0392ec5a17ccdf7e3d323361eb17b0c9fcd 100644 --- a/program/migrations/0008_auto_20220117_1721.py +++ b/program/migrations/0008_auto_20220117_1721.py @@ -1,8 +1,9 @@ # Generated by Django 2.2.25 on 2022-01-17 16:21 -from django.db import migrations, models import versatileimagefield.fields +from django.db import migrations, models + class Migration(migrations.Migration): diff --git a/program/migrations/0011_link.py b/program/migrations/0011_link.py index 209ff5fd2df610f536cfcc96e0b8b82b7ae643b5..120dd78aa6955867de547938b060c20d0228fe25 100644 --- a/program/migrations/0011_link.py +++ b/program/migrations/0011_link.py @@ -1,7 +1,7 @@ # Generated by Django 3.2.11 on 2022-01-27 16:33 -from django.db import migrations, models import django.db.models.deletion +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/program/migrations/0012_auto_20180104_0005.py b/program/migrations/0012_auto_20180104_0005.py index b3a7011186d162ce4e5422870451b857c565fc04..a1b9dd1a75171bd2c996015e10316cf044d3a370 100644 --- a/program/migrations/0012_auto_20180104_0005.py +++ b/program/migrations/0012_auto_20180104_0005.py @@ -2,10 +2,11 @@ # Generated by Django 1.11.3 on 2018-01-03 23:05 from __future__ import unicode_literals +import versatileimagefield.fields + +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion -import versatileimagefield.fields class Migration(migrations.Migration): @@ -382,8 +383,8 @@ class Migration(migrations.Migration): blank=True, height_field="height", help_text="Upload a picture of yourself. Images are automatically cropped around" - " the 'Primary Point of Interest'. Click in the image to change it and" - " press Save.", + " the 'Primary Point of Interest'. Click in the image to change it and" + " press Save.", null=True, upload_to="host_images", verbose_name="Profile picture", @@ -449,7 +450,7 @@ class Migration(migrations.Migration): field=models.IntegerField( blank=True, help_text="Link the note to a certain CBA post by giving its ID. (E.g. if your" - " post's CBA URL is https://cba.fro.at/1234, then your CBA ID is 1234)", + " post's CBA URL is https://cba.fro.at/1234, then your CBA ID is 1234)", null=True, verbose_name="CBA ID", ), @@ -478,8 +479,8 @@ class Migration(migrations.Migration): blank=True, height_field="height", help_text="Upload an image to your show. Images are automatically cropped around" - " the 'Primary Point of Interest'. Click in the image to change it and" - " press Save.", + " the 'Primary Point of Interest'. Click in the image to change it and" + " press Save.", null=True, upload_to="note_images", verbose_name="Featured image", @@ -514,8 +515,8 @@ class Migration(migrations.Migration): field=models.TextField( blank=True, help_text="Describe your upcoming show in some sentences. Avoid technical data" - " like airing times and contact information. They will be added" - " automatically.", + " like airing times and contact information. They will be added" + " automatically.", verbose_name="Summary", ), ), @@ -543,8 +544,8 @@ class Migration(migrations.Migration): field=models.IntegerField( blank=True, help_text="Link your show to a CBA series by giving its ID. This will enable CBA" - " upload and will automatically link your show to your CBA archive. Find" - " out your ID under https://cba.fro.at/series", + " upload and will automatically link your show to your CBA archive. Find" + " out your ID under https://cba.fro.at/series", null=True, verbose_name="CBA Series ID", ), @@ -660,9 +661,9 @@ class Migration(migrations.Migration): name="title", field=models.CharField( help_text="Give your note a good headline. What will your upcoming show be about?" - " Try to arouse interest to listen to it!<br>Avoid technical data like" - " the show's name, its airing times or its episode number. These data" - " are added automatically.", + " Try to arouse interest to listen to it!<br>Avoid technical data like" + " the show's name, its airing times or its episode number. These data" + " are added automatically.", max_length=128, verbose_name="Title", ), @@ -695,8 +696,8 @@ class Migration(migrations.Migration): blank=True, height_field="height", help_text="Upload an image to your show. Images are automatically cropped around" - " the 'Primary Point of Interest'. Click in the image to change it and" - " press Save.", + " the 'Primary Point of Interest'. Click in the image to change it and" + " press Save.", null=True, upload_to="show_images", verbose_name="Image", @@ -717,7 +718,7 @@ class Migration(migrations.Migration): name="short_description", field=models.TextField( help_text="Describe your show in some sentences. Avoid technical data like airing" - " times and contact information. They will be added automatically.", + " times and contact information. They will be added automatically.", verbose_name="Short description", ), ), diff --git a/program/migrations/0013_auto_20220221_1637.py b/program/migrations/0013_auto_20220221_1637.py index 7832adec4a7fe4c44260e91b54048bedd1d440ce..dbd6cb517e418444bcf479afa659d16c7d835d2d 100644 --- a/program/migrations/0013_auto_20220221_1637.py +++ b/program/migrations/0013_auto_20220221_1637.py @@ -1,9 +1,10 @@ # Generated by Django 3.2.11 on 2022-02-21 15:37 +import versatileimagefield.fields + +import django.db.models.deletion from django.conf import settings from django.db import migrations, models -import django.db.models.deletion -import versatileimagefield.fields class Migration(migrations.Migration): diff --git a/program/migrations/0014_auto_20180216_2000.py b/program/migrations/0014_auto_20180216_2000.py index 787fbf708a334577661bfbca7bdf6b13e4537fb8..6329c3f14388f4c27d86efd0b1324a0be97b41d1 100644 --- a/program/migrations/0014_auto_20180216_2000.py +++ b/program/migrations/0014_auto_20180216_2000.py @@ -2,8 +2,8 @@ # Generated by Django 1.11.3 on 2018-02-16 20:00 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): diff --git a/program/migrations/0016_auto_20180222_1253.py b/program/migrations/0016_auto_20180222_1253.py index a62ca8d15f4b013b2aebfac189652083682e7b4c..0510a88142f5f8ae57839953541e158e15bb4e6a 100644 --- a/program/migrations/0016_auto_20180222_1253.py +++ b/program/migrations/0016_auto_20180222_1253.py @@ -2,9 +2,10 @@ # Generated by Django 1.11.3 on 2018-02-22 12:53 from __future__ import unicode_literals -from django.db import migrations import versatileimagefield.fields +from django.db import migrations + class Migration(migrations.Migration): @@ -20,8 +21,8 @@ class Migration(migrations.Migration): blank=True, height_field="height", help_text="Upload an image to your note. Images are automatically cropped around" - " the 'Primary Point of Interest'. Click in the image to change it and" - " press Save.", + " the 'Primary Point of Interest'. Click in the image to change it and" + " press Save.", null=True, upload_to="note_images", verbose_name="Featured image", diff --git a/program/migrations/0018_auto_20190810_1146.py b/program/migrations/0018_auto_20190810_1146.py index 4ed3879545d1710f4ad3edc8a21cb4dd8eb76fc1..846fb56bd75dafc816464c4a2bc1d92a9ed30d3b 100644 --- a/program/migrations/0018_auto_20190810_1146.py +++ b/program/migrations/0018_auto_20190810_1146.py @@ -18,8 +18,8 @@ class Migration(migrations.Migration): field=models.IntegerField( blank=True, help_text="Link your show to a CBA series by giving its ID. This will enable CBA" - " upload and will automatically link your show to your CBA archive. Find" - " out your show's ID under https://cba.fro.at/series", + " upload and will automatically link your show to your CBA archive. Find" + " out your show's ID under https://cba.fro.at/series", null=True, verbose_name="CBA Series ID", ), @@ -30,7 +30,7 @@ class Migration(migrations.Migration): field=models.IntegerField( blank=True, help_text="If a timeslot of your show is empty, this playlist will be aired as a" - " backup.", + " backup.", null=True, verbose_name="Fallback ID", ), @@ -51,8 +51,8 @@ class Migration(migrations.Migration): name="short_description", field=models.TextField( help_text="Describe your show for your listeners in some sentences. Avoid" - " technical data like airing times and contact information. They will be" - " added automatically.", + " technical data like airing times and contact information. They will be" + " added automatically.", verbose_name="Short description", ), ), diff --git a/program/migrations/0019_auto_20190810_1340.py b/program/migrations/0019_auto_20190810_1340.py index f6138a3e82e2413041bdb2f8e2acf2b0a38d2bc1..85bf5ca52ff82ff577623b55d412f40044eec509 100644 --- a/program/migrations/0019_auto_20190810_1340.py +++ b/program/migrations/0019_auto_20190810_1340.py @@ -2,8 +2,8 @@ # Generated by Django 1.11.3 on 2019-08-10 13: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): diff --git a/program/migrations/0020_auto_20190810_1341.py b/program/migrations/0020_auto_20190810_1341.py index ad8b2f99382a2627c9040a415ae73079fd840dd6..d98c18890430567152fe11bc8558f2578aee339d 100644 --- a/program/migrations/0020_auto_20190810_1341.py +++ b/program/migrations/0020_auto_20190810_1341.py @@ -2,8 +2,8 @@ # Generated by Django 1.11.3 on 2019-08-10 13:41 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): diff --git a/program/migrations/0022_show_is_public.py b/program/migrations/0022_show_is_public.py index ef05e399ed17b1cdb8c2682a063c68fd2dfbfae2..adce478b0c03e2c3733530f1c06256fea059f8f6 100644 --- a/program/migrations/0022_show_is_public.py +++ b/program/migrations/0022_show_is_public.py @@ -18,7 +18,7 @@ class Migration(migrations.Migration): field=models.BooleanField( default=False, help_text="Files and Playlists of Public Shows can only be changed by owners but" - " may be used by everyone.", + " may be used by everyone.", verbose_name="Is Public?", ), ), diff --git a/program/models.py b/program/models.py index 3ee04e0d4f2b5a6abfbcac9a53cdf6bebba27cc1..511ba383f467225930dd58bdf2eb672cff2cda8a 100644 --- a/program/models.py +++ b/program/models.py @@ -22,6 +22,8 @@ from datetime import datetime, time, timedelta from dateutil.relativedelta import relativedelta from dateutil.rrule import rrule +from versatileimagefield.fields import PPOIField, VersatileImageField + from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist from django.db import models @@ -29,14 +31,12 @@ from django.db.models import Q from django.forms.models import model_to_dict from django.utils import timezone from django.utils.translation import gettext_lazy as _ -from versatileimagefield.fields import VersatileImageField, PPOIField - +from program.utils import parse_date, parse_datetime, parse_time from steering.settings import ( - THUMBNAIL_SIZES, - AUTO_SET_UNTIL_DATE_TO_END_OF_YEAR, AUTO_SET_UNTIL_DATE_TO_DAYS_IN_FUTURE, + AUTO_SET_UNTIL_DATE_TO_END_OF_YEAR, + THUMBNAIL_SIZES, ) -from program.utils import parse_datetime, parse_date, parse_time class Type(models.Model): diff --git a/program/serializers.py b/program/serializers.py index 9c798b1fc18ce227e5db7aa15a4adf4b4726ab3f..a8b85bba2bc58648d83b35973addd2bcbf01f426 100644 --- a/program/serializers.py +++ b/program/serializers.py @@ -18,30 +18,31 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # +from profile.models import Profile +from profile.serializers import ProfileSerializer + +from rest_framework import serializers + from django.contrib.auth.models import User from django.core.exceptions import ObjectDoesNotExist from django.utils import timezone -from rest_framework import serializers - -from profile.models import Profile -from profile.serializers import ProfileSerializer from program.models import ( - Show, - Schedule, - TimeSlot, Category, FundingCategory, Host, - Topic, + Language, + Link, MusicFocus, Note, - Type, - Language, RRule, - Link, + Schedule, + Show, + TimeSlot, + Topic, + Type, ) -from steering.settings import THUMBNAIL_SIZES from program.utils import get_audio_url +from steering.settings import THUMBNAIL_SIZES class UserSerializer(serializers.ModelSerializer): diff --git a/program/utils.py b/program/utils.py index 729af024a7267e43a02fa07ef72e06caba2dbc20..6d30c2079d584dbf794f9ac5eff8430bb40df0c5 100644 --- a/program/utils.py +++ b/program/utils.py @@ -18,12 +18,12 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -from datetime import datetime, date, time -from typing import Dict, Optional, Union, Tuple +from datetime import date, datetime, time +from typing import Dict, Optional, Tuple, Union import requests -from django.utils import timezone +from django.utils import timezone from steering.settings import CBA_AJAX_URL, CBA_API_KEY, DEBUG diff --git a/program/views.py b/program/views.py index 197f32c226b4abfefb9ffcb15285a97c86550370..e2ec555c5a62aadc28e916226360b2c4215a8644 100644 --- a/program/views.py +++ b/program/views.py @@ -22,44 +22,44 @@ import json import logging from datetime import date, datetime, time, timedelta +from rest_framework import permissions, status, viewsets +from rest_framework.pagination import LimitOffsetPagination +from rest_framework.response import Response + from django.contrib.auth.models import User from django.db.models import Q from django.http import HttpResponse from django.shortcuts import get_object_or_404 from django.utils import timezone from django.utils.translation import gettext as _ -from rest_framework import permissions, status, viewsets -from rest_framework.pagination import LimitOffsetPagination -from rest_framework.response import Response - from program.models import ( - Type, - MusicFocus, - Language, - Note, - Show, Category, FundingCategory, - Topic, - TimeSlot, Host, + Language, + MusicFocus, + Note, Schedule, + Show, + TimeSlot, + Topic, + Type, ) from program.serializers import ( - TypeSerializer, + CategorySerializer, + FundingCategorySerializer, + HostSerializer, LanguageSerializer, MusicFocusSerializer, NoteSerializer, - ShowSerializer, ScheduleSerializer, - CategorySerializer, - FundingCategorySerializer, - TopicSerializer, + ShowSerializer, TimeSlotSerializer, - HostSerializer, + TopicSerializer, + TypeSerializer, UserSerializer, ) -from program.utils import parse_date, get_values, get_pk_and_slug +from program.utils import get_pk_and_slug, get_values, parse_date logger = logging.getLogger(__name__) diff --git a/steering/oidc_provider_settings.py b/steering/oidc_provider_settings.py index e0f5537e313c8f8f1356c1c6c3d5a7399a4c7019..400fe29b34b0864c2fb8b0a764a4b678f545e217 100644 --- a/steering/oidc_provider_settings.py +++ b/steering/oidc_provider_settings.py @@ -18,9 +18,10 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -from django.utils.translation import gettext as _ from oidc_provider.lib.claims import ScopeClaims +from django.utils.translation import gettext as _ + class AuraScopeClaims(ScopeClaims): info_username = ( diff --git a/steering/urls.py b/steering/urls.py index e2be51e364a859eef027b8cc911293d79da33c67..fdad4b383cf77da35c0620733567525c9a9c14cb 100644 --- a/steering/urls.py +++ b/steering/urls.py @@ -18,23 +18,23 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -from django.urls import include, path -from django.contrib import admin from rest_framework_nested import routers +from django.contrib import admin +from django.urls import include, path from program.views import ( - APIUserViewSet, + APICategoryViewSet, + APIFundingCategoryViewSet, APIHostViewSet, - APIShowViewSet, + APILanguageViewSet, + APIMusicFocusViewSet, + APINoteViewSet, APIScheduleViewSet, + APIShowViewSet, APITimeSlotViewSet, - APINoteViewSet, - APICategoryViewSet, - APITypeViewSet, APITopicViewSet, - APIMusicFocusViewSet, - APIFundingCategoryViewSet, - APILanguageViewSet, + APITypeViewSet, + APIUserViewSet, json_day_schedule, json_playout, )