diff --git a/program/admin.py b/program/admin.py index 14f3a45c3fce053d38f3e7594e4b396073754e25..c93c9a14c16a61a4213ec9a0f67188691783784f 100644 --- a/program/admin.py +++ b/program/admin.py @@ -210,7 +210,7 @@ class ScheduleAdmin(admin.ModelAdmin): fields = ( ('rrule', 'byweekday'), ('tstart', 'tend'), 'dstart', 'until', 'is_repetition', ('add_days_no', 'add_business_days_only'), - 'fallback_id', 'automation_id',) + 'default_id', 'automation_id',) list_display = ('get_show_name', 'byweekday', 'rrule', 'tstart', 'tend', 'until') list_filter = (ActiveSchedulesFilter, 'byweekday', 'rrule', 'is_repetition') ordering = ('byweekday', 'dstart') @@ -252,7 +252,7 @@ class ShowAdmin(admin.ModelAdmin): fields = ( 'predecessor', 'type', 'name', 'slug', 'image', 'logo', 'short_description', 'description', 'email', 'website', 'hosts', 'owners', 'language', 'category', 'fundingcategory', 'topic', - 'musicfocus', 'fallback_id', 'cba_series_id', 'is_active', 'is_public' + 'musicfocus', 'default_id', 'cba_series_id', 'is_active', 'is_public' ) class Media: @@ -419,8 +419,8 @@ class ShowAdmin(admin.ModelAdmin): is_repetition = request.POST.get('ps_save_is_repetition') automation_id = int(request.POST.get('ps_save_automation_id')) if request.POST.get( 'ps_save_automation_id') != 'None' else 0 - fallback_id = int(request.POST.get('ps_save_fallback_id')) if request.POST.get( - 'ps_save_fallback_id') != 'None' else 0 + default_id = int(request.POST.get('ps_save_default_id')) if request.POST.get( + 'ps_save_default_id') != 'None' else 0 add_days_no = int(request.POST.get('ps_save_add_days_no')) if request.POST.get( 'ps_save_add_days_no') != 'None' and int(request.POST.get('ps_save_add_days_no')) > 0 else None add_business_days_only = request.POST.get('ps_save_add_business_days_only') @@ -467,7 +467,7 @@ class ShowAdmin(admin.ModelAdmin): until=until, is_repetition=is_repetition, automation_id=automation_id, - fallback_id=fallback_id, + default_id=default_id, add_days_no=add_days_no, add_business_days_only=add_business_days_only) diff --git a/program/models.py b/program/models.py index 889888b8bf0844a319b9cd727d7fe3f23354b43d..a74a073ec8dcab8144f9c63c442e73eb43941944 100644 --- a/program/models.py +++ b/program/models.py @@ -358,7 +358,7 @@ class Show(models.Model): cba_series_id = models.IntegerField(_("CBA Series ID"), blank=True, null=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")) - fallback_id = models.IntegerField(_("Fallback ID"), blank=True, null=True, help_text=_( + default_id = models.IntegerField(_("Default ID"), blank=True, null=True, help_text=_( "If a timeslot of your show is empty, this playlist will be aired as a backup.")) created = models.DateTimeField(auto_now_add=True, editable=False) last_updated = models.DateTimeField(auto_now=True, editable=False) @@ -449,7 +449,7 @@ class Schedule(models.Model): is_repetition = models.BooleanField(_("Is repetition"), default=False) add_days_no = models.IntegerField(_("Add days"), blank=True, null=True) add_business_days_only = models.BooleanField(_("Only add business days?"), default=False) - fallback_id = models.IntegerField(_("Fallback ID"), blank=True, null=True) + default_id = models.IntegerField(_("Default ID"), blank=True, null=True) automation_id = models.IntegerField(_("Automation ID"), blank=True, null=True, choices=get_automation_id_choices()) # Deprecated # -> both see https://stackoverflow.com/questions/1737017/django-auto-now-and-auto-now-add @@ -488,7 +488,7 @@ class Schedule(models.Model): show = Show.objects.get(pk=int(show_pk)) is_repetition = True if 'is_repetition' in sdl and sdl['is_repetition'] is True else False - fallback_id = int(sdl['fallback_id']) if sdl['fallback_id'] else None + default_id = int(sdl['default_id']) if sdl['default_id'] else None automation_id = int(sdl['automation_id']) if sdl['automation_id'] else None add_days_no = int(sdl['add_days_no']) if sdl['add_days_no'] > 0 else None add_business_days_only = True if 'add_business_days_only' in sdl and sdl['add_business_days_only'] is True else False @@ -520,7 +520,7 @@ class Schedule(models.Model): schedule = Schedule(pk=pk, byweekday=sdl['byweekday'], rrule=rrule, dstart=dstart, tstart=tstart, tend=tend, until=until, is_repetition=is_repetition, - fallback_id=fallback_id, show=show, + default_id=default_id, show=show, add_days_no=add_days_no, add_business_days_only=add_business_days_only) return schedule diff --git a/program/serializers.py b/program/serializers.py index 700ded63936ee3355097e21fc6c4c751c5d83531..8b4431fa1c8d59c550b3cac00d243031c58b0b99 100644 --- a/program/serializers.py +++ b/program/serializers.py @@ -266,7 +266,7 @@ class ShowSerializer(serializers.HyperlinkedModelSerializer): model = Show fields = ('id', 'name', 'slug', 'image', 'ppoi', 'logo', 'short_description', 'description', 'email', 'website', 'created', 'last_updated', 'type', 'fundingcategory', - 'predecessor', 'cba_series_id', 'fallback_id', 'category', 'hosts', + 'predecessor', 'cba_series_id', 'default_id', 'category', 'hosts', 'owners', 'language', 'topic', 'musicfocus', 'thumbnails', 'is_active', 'is_public') def create(self, validated_data): @@ -311,7 +311,7 @@ class ShowSerializer(serializers.HyperlinkedModelSerializer): instance.email = validated_data.get('email', instance.email) instance.website = validated_data.get('website', instance.website) instance.cba_series_id = validated_data.get('cba_series_id', instance.cba_series_id) - instance.fallback_id = validated_data.get('fallback_id', instance.fallback_id) + instance.default_id = validated_data.get('default_id', instance.default_id) # Only superusers may update the following fields if user.is_superuser: @@ -361,7 +361,7 @@ class ScheduleSerializer(serializers.ModelSerializer): instance.tend = validated_data.get('tend', instance.tend) instance.until = validated_data.get('until', instance.until) instance.is_repetition = validated_data.get('is_repetition', instance.is_repetition) - instance.fallback_id = validated_data.get('fallback_id', instance.fallback_id) + instance.default_id = validated_data.get('default_id', instance.default_id) instance.automation_id = validated_data.get('automation_id', instance.automation_id) instance.rrule = validated_data.get('rrule', instance.rrule) instance.show = validated_data.get('show', instance.show) diff --git a/program/views.py b/program/views.py index 10309aac5cd07daf9d8752b3ce1c8581ec686a26..0f6c9a7407665e1c276ca0fd772e4c1a5a5d7f65 100644 --- a/program/views.py +++ b/program/views.py @@ -36,7 +36,7 @@ from program.serializers import TypeSerializer, LanguageSerializer, MusicFocusSe ScheduleSerializer, CategorySerializer, FundingCategorySerializer, TopicSerializer, TimeSlotSerializer, HostSerializer, \ UserSerializer from program.utils import get_cached_shows -from pv.settings import STATION_FALLBACK_ID +from pv.settings import STATION_DEFAULT_ID def json_day_schedule(request, year=None, month=None, day=None): @@ -121,8 +121,8 @@ def json_playout(request): 'schedule_id': ts.schedule.id, 'is_repetition': ts.is_repetition, 'playlist_id': ts.playlist_id, - 'schedule_fallback_id': ts.schedule.fallback_id, - 'show_fallback_id': ts.show.fallback_id, + 'schedule_default_id': ts.schedule.default_id, + 'show_default_id': ts.show.default_id, 'show_id': ts.show.id, 'show_name': ts.show.name + is_repetition, 'show_hosts': hosts, @@ -132,7 +132,7 @@ def json_playout(request): 'show_musicfocus': musicfocus, 'show_languages': languages, 'show_fundingcategory': fdcategory, - 'station_fallback_id': STATION_FALLBACK_ID, # TODO: Find a better way than getting it from the settings + 'station_default_id': STATION_DEFAULT_ID, # TODO: Find a better way than getting it from the settings 'memo': ts.memo, 'className': classname, } @@ -473,7 +473,7 @@ class APIScheduleViewSet(viewsets.ModelViewSet): # First update submit -> return projected timeslots and collisions if 'solutions' not in request.data: - # TODO: If nothing else than fallback_id, automation_id or is_repetition changed -> just save and don't do anything + # TODO: If nothing else than default_id, automation_id or is_repetition changed -> just save and don't do anything return Response(Schedule.make_conflicts(request.data['schedule'], pk, show_pk)) # Otherwise try to resolve diff --git a/pv/settings.py b/pv/settings.py index 365d775513ab97978ee724ff3bd0c68ac1fe3d51..0a7bf2cd96db013e2ef516ad075e8d9e512cd20b 100644 --- a/pv/settings.py +++ b/pv/settings.py @@ -167,9 +167,9 @@ AUTO_SET_UNTIL_DATE_TO_DAYS_IN_FUTURE = 365 # Overrides the above setting if True AUTO_SET_UNTIL_DATE_TO_END_OF_YEAR = True -# The station's fallback playlist ID +# The station's default playlist ID # If there's no program, this playlist will be aired as a backup -STATION_FALLBACK_ID = None +STATION_DEFAULT_ID = None # URL to CBA - Cultural Broadcasting Archive CBA_URL = 'https://cba.fro.at'