1π
β
but I canβt find any information about what is athlete_list and where is from.
This is a context variable. You can for example pass this with render(β¦)
:
def my_view(request):
# β¦
render(request, 'the-template.html', {'athlete_list': ['list', 'of', 'athletes']})
For a ListView
, you can set the variable name that is associated with the QuerySet
through the context_object_name
attribute [Django-doc]. By default this is modename_list
, so if the model is Athlete
, then it is athlete_list
:
class AthleteListView(ListView):
model = OtherThanAthlete
context_object_name = 'athlete_list'
Source:stackexchange.com