add a latest method to query the latest x events

This commit is contained in:
2017-11-23 14:15:12 +01:00
parent 92470514c4
commit 68c484afc9
8 changed files with 81 additions and 77 deletions

View File

@@ -13,7 +13,7 @@ class HanchanManager(models.Manager):
"""
use_for_related_fields = True
def confirmed_hanchans(self, user=None, since=None, until=None, **filter_args):
def confirmed(self, user=None, since=None, until=None, **filter_args):
""" Return all valid and confirmed Hanchans.
:param user: Only return Hanchans where this user participated.
@@ -85,7 +85,7 @@ class HanchanManager(models.Manager):
season = season or until.year
except AttributeError:
season = date.today().year
return self.confirmed_hanchans(user=user, season=season, until=until)
return self.confirmed(user=user, season=season, until=until)
def user_hanchans(self, user, since=None, until=None, **filter_args):
"""Return all Hanchans where a specific user has participated.
@@ -108,7 +108,7 @@ class HanchanManager(models.Manager):
[hanchan.get_playerdata(user) for hanchan in queryset]
return queryset
def unconfirmed_hanchans(self, user=None, **filter_args):
def unconfirmed(self, user=None, **filter_args):
""" Return all Hanchans that have been set to unconfirmed.
:param user: Only return Hanchans where this user participated.