title: Django - Where is the context variable?
body: <p>I'm still getting used to class based views, while I get the general purpose, some things still get past me. I'm following a tutorial which basically walks you through the motions but tends to ignore the fuzzy details, such as this piece of code:</p>
  
  <pre><code>class LoanedBooksByUserListView(LoginRequiredMixin,generic.ListView):
      """Generic class-based view listing books on loan to current user."""
      model = BookInstance
      template_name ='books/bookinstance_list_borrowed_user.html'
      paginate_by = 1
  
      def get_queryset(self):
          return BookInstance.objects.filter(
              borrower=self.request.user
          ).filter(status__exact='o').order_by('due_back')
  </code></pre>
  
  <p>I get the model, template_name and paginate_by parts, they're attributes of the ListView class, but what I don't get is the get_queryset part, where is it executed? As seen in the code below it's called nowhere. Where is it returned to? I guess my first question can be chalked down to "What do functions in class based views do?"</p>
  
  <pre><code>{% extends "base_generic.html" %}
  
  {% block content %}
  &lt;h1&gt;Borrowed books&lt;/h1&gt;
  
  {% if bookinstance_list %}
  &lt;ul&gt;
  
    {% for bookinst in bookinstance_list %} 
    &lt;li class="{% if bookinst.is_overdue %}text-danger{% endif %}"&gt;
      &lt;a href="{% url 'book-detail' bookinst.book.pk %}"&gt;{{bookinst.book.title}}&lt;/a&gt; ({{ bookinst.due_back }})        
    &lt;/li&gt;
    {% endfor %}
  &lt;/ul&gt;
  
  {% else %}
    &lt;p&gt;There are no books borrowed.&lt;/p&gt;
  {% endif %}       
  </code></pre>
  
  <p>So, two issues, first, where did the get_queryset return to, and second, what is 
  bookinstance_list? It's not a context variable, but seems to be used out of the blue, why is this variable usable?</p>