Resolve "Recently added radio isn't working has expected (#1674)" (!1479)

This commit is contained in:
Petitminion 2022-01-28 16:51:08 +01:00 committed by JuniorJPDJ
parent ddb7023f1b
commit 0be63131ef
1 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,4 @@
import datetime
import random
from django.core.exceptions import ValidationError
@ -326,5 +327,9 @@ class LibraryRadio(RelatedObjectRadio):
@registry.register(name="recently-added")
class RecentlyAdded(SessionRadio):
def get_queryset(self, **kwargs):
date = datetime.date.today() - datetime.timedelta(days=30)
qs = super().get_queryset(**kwargs)
return qs.filter(artist__content_category="music").order_by("-creation_date")
return qs.filter(
Q(artist__content_category="music"),
Q(creation_date__gt=date),
)