title: Django: ListView. Where can I declare variables that I want to have on template?
body: <p>One of my tables in my app is called <code>Gallery</code> and I have the following class to list all of the objects on that table: </p>
  
  <pre><code>from django.views.generic import ListView
  from galleries.models import Gallery 
  
  class GalleryList(ListView):
   template_name = "path/to/template"
   context_object_name = "object_list"
  
   def queryset(self):
    return Gallery.objects.order_by('-title')[:20]
  </code></pre>
  
  <p>And it does the job. On my template I do the following: </p>
  
  <pre><code>{% block gallery_list %}
      &lt;h1&gt;Gallery List&lt;/h1&gt;
      &lt;ul&gt;
          {% for gallery in object_list %}
              &lt;li&gt;&lt;img src="{{ gallery.thumbnail.url }}" /&gt;{{ gallery.title }}&lt;/li&gt;
          {% endfor %}
      &lt;/ul&gt;
  {% endblock %}
  </code></pre>
  
  <p>Everything works as expected. The thing here is that on my <code>base.html</code> template I have <code>{% block title %}</code> for the <code>meta title</code> tag, <code>{% block description %}</code> for my <code>meta description</code> tag in the header. And I want to be able to declare it somewhere and pass it to the view. To be clear, the variables <code>title</code> and <code>description</code> are strings (ex: <code>title="List of all galleries on website"</code>).</p>
  
  <p>On the view I want to do something like: </p>
  
  <pre><code>{% extends "base.html" %}
  
  {% block title %}{{ title }}{% endblock %}
  {% block description %}{{ description|default:title }}{% endblock %}
  </code></pre>
  
  <p>But, on the class <code>GalleryList</code> I don't know where to declare the variables <code>title</code> and <code>description</code>. I don't know if that's possible or proper for Django. I want to do what's right. </p>
  
  <p>Also, as I have a costume template for listing all the galleries I could just do: </p>
  
  <pre><code>{% extends "base.html" %}
  
  {% block title %}List of all galleries on website{% endblock %}
  {% block description %}List of all galleries on website...{% endblock %}
  </code></pre>
  
  <p>But then again, I don't know if that's proper for a well coded Django app. I'm a beginner with Django and I would like to know what's the way to go about this. Hope my question is clear enough. </p>