Add history funtions for song requests.
This commit is contained in:
parent
311f744d62
commit
7d4446c5b2
1 changed files with 9 additions and 0 deletions
|
@ -9,5 +9,14 @@ class RequestManager(models.Manager):
|
|||
return self.get_queryset().filter(queued_at__isnull=True,
|
||||
played_at__isnull=True)
|
||||
|
||||
def played(self):
|
||||
return self.get_queryset().filter(models.Q(queued_at__isnull=False) |
|
||||
models.Q(played_at__isnull=False))
|
||||
|
||||
def get_played_requests(self, limit=None):
|
||||
if limit:
|
||||
return self.played()[0:limit]
|
||||
return self.played()
|
||||
|
||||
def next_request(self):
|
||||
return self.unplayed().earliest('created_date')
|
||||
|
|
Loading…
Reference in a new issue