diff --git a/marietje/marietje/settings.py b/marietje/marietje/settings.py index 1642d39..f7a7621 100644 --- a/marietje/marietje/settings.py +++ b/marietje/marietje/settings.py @@ -121,7 +121,7 @@ AUTH_USER_MODEL = 'marietje.User' LANGUAGE_CODE = 'en-us' -TIME_ZONE = 'UTC' +TIME_ZONE = 'Europe/Amsterdam' USE_I18N = True @@ -144,4 +144,8 @@ BERTHA_HOST = ('hardcoding.nl', 1819) MAIL_FROM = 'marietje@hardcoding.nl' + MAX_MINUTES_IN_A_ROW = 20 + +# Time range (dependent on timezone specified) when MAX_MINUTES_IN_A_ROW is in effect. +LIMIT_HOURS = (12, 16) diff --git a/marietje/queues/models.py b/marietje/queues/models.py index 66a733c..69eb785 100644 --- a/marietje/queues/models.py +++ b/marietje/queues/models.py @@ -2,6 +2,7 @@ from django.db import models from django.db.models import Q, Max from django.conf import settings from songs.models import Song +from django.utils import timezone class Playlist(models.Model): @@ -122,8 +123,9 @@ class Queue(models.Model): else: seconds_in_a_row += playlist_song.song.duration + now = timezone.now() if seconds_in_a_row > 0 and seconds_in_a_row + song.duration > settings.MAX_MINUTES_IN_A_ROW * 60\ - and not user.is_superuser: + and not user.is_superuser and settings.LIMIT_HOURS[0] <= now.hour < settings.LIMIT_HOURS[1]: return False if order is None: