From 2f97870d8100d4c4aa4a2de8f417165ee5fefb06 Mon Sep 17 00:00:00 2001 From: PhlexPlexico Date: Wed, 27 Nov 2019 22:02:33 -0600 Subject: [PATCH] Resolves #172 Users can only see their own seasons within season selection, but can view matches within `/seasons` or whichever the link for it is. --- get5/match.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/get5/match.py b/get5/match.py index b2c8c0d..129abbe 100755 --- a/get5/match.py +++ b/get5/match.py @@ -180,7 +180,11 @@ def add_seasons(self): self.season_selection.choices = [] season_tuples = [] season_tuples.append((0, 'No Season')) - for seasons in Season.query.filter((Season.end_date >= datetime.now()) | (Season.end_date.is_(None))).order_by(-Season.id): + if g.user.super_admin or g.user.admin: + ourSeasons = Season.query.filter((Season.end_date >= datetime.now()) | (Season.end_date.is_(None))).order_by(-Season.id) + else: + ourSeasons = Season.query.filter((Season.end_date >= datetime.now()) | (Season.end_date.is_(None))).filter(Season.user_id == g.user.id).order_by(-Season.id) + for seasons in : season_tuples.append((seasons.id, seasons.name)) self.season_selection.choices += season_tuples