I created a table using django-tables2 and everything is working fince except that I want to add other instances or variable to the url template.
Here is my view:
def SpecificPLayer(request, playerslug):
player = Player_Bios.objects.get(player_id=playerslug)
table= StatTable(BatStat.objects.filter(player_id=playerslug).values('season','team_id'))
RequestConfig(request, paginate=False).configure(table)
return render(request, 'singleplayer.html', {'table': table})
What about if I want to pass the following to the template:
today = date.today()
My common sense told me to do this:
return render(request, 'singleplayer.html','today':taday {'table': table}) #does not work
on my singleplayer.html, I have the following:
{{ today }}
the answer is:
return render(request, 'singleplayer.html', {'table': table, 'today':taday})