2017-12-29 14:56:47 +00:00
|
|
|
from django.db import models
|
|
|
|
|
2018-03-29 16:14:24 +00:00
|
|
|
from core.querysets import EnabledQuerySet, PublishedQuerySet
|
2017-12-29 14:56:47 +00:00
|
|
|
|
|
|
|
|
2018-03-29 16:14:24 +00:00
|
|
|
class SongTypeQuerySet(models.QuerySet):
|
2017-12-29 14:56:47 +00:00
|
|
|
"""
|
|
|
|
Queryset to select all objects that are either songs or jingles.
|
|
|
|
"""
|
|
|
|
def songs(self):
|
|
|
|
return self.filter(song_type='S')
|
|
|
|
|
|
|
|
def jingles(self):
|
|
|
|
return self.filter(song_type='J')
|
|
|
|
|
|
|
|
|
2018-03-29 16:14:24 +00:00
|
|
|
class RadioQuerySet(EnabledQuerySet, PublishedQuerySet):
|
|
|
|
"""
|
|
|
|
Queryset combination that can easily select enabled and published
|
|
|
|
objects.
|
|
|
|
"""
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class SongQuerySet(RadioQuerySet, SongTypeQuerySet):
|
2017-12-29 14:56:47 +00:00
|
|
|
"""
|
|
|
|
Queryset combination that can easily select enabled objects, published
|
|
|
|
objects, and objects of a certain song type.
|
|
|
|
"""
|
|
|
|
pass
|