From: Frédéric Péters Date: Sat, 18 Jul 2020 14:12:10 +0000 (+0200) Subject: misc: distinct active and available tracks in artist view X-Git-Tag: v2021~115 X-Git-Url: https://git.0d.be/?p=django-panik-nonstop.git;a=commitdiff_plain;h=ee8becb1ac81369180a47013414499ca21d4a1ac misc: distinct active and available tracks in artist view --- diff --git a/nonstop/models.py b/nonstop/models.py index 7563104..591a415 100644 --- a/nonstop/models.py +++ b/nonstop/models.py @@ -43,6 +43,12 @@ class Artist(models.Model): return SomaLogLine.objects.filter(filepath__track__artist=self ).exclude(on_air=False).order_by('-play_timestamp') + def active_tracks(self): + return self.track_set.filter(nonstop_zones__isnull=False).distinct().order_by('title') + + def available_tracks(self): + return self.track_set.filter(nonstop_zones__isnull=True).order_by('title') + class Album(models.Model): name = models.CharField(_('Name'), max_length=255) diff --git a/nonstop/templates/nonstop/artist_detail.html b/nonstop/templates/nonstop/artist_detail.html index 50174f0..3738b73 100644 --- a/nonstop/templates/nonstop/artist_detail.html +++ b/nonstop/templates/nonstop/artist_detail.html @@ -30,12 +30,29 @@ +
+

{% trans "Active tracks" %}

+ + +
+ +

{% trans "Available tracks" %}