def test_stats(team, *args):
if not args:
[do some stuff]
else:
team_fixtures = (Fixtures.objects.filter(home_team=team_details.id) | Fixtures.objects.filter(away_team=team_details.id))/
.filter(fixture_datetime__lt=datetime.now()).filter(fixture_datetime__year=args[0])
And for reference sake - args is:
date_year = datetime.now().year
for this query to work i need to reference args as
.filter(fixture_datetime__year=args[0])
because if I use
.filter(fixture_datetime__year=args)
I get the error:
int() argument must be a string, a bytes-like object or a number, not 'tuple'
I understand that it thinks it's a tuple even though it's only one value but when I do the following in terminal
type(date_year)
I get class back.
Why do I have to reference position here when it looks to be just one value returning?