title: How I do render a queryset in a Django base template?
body: <p>I have a base template which extends to almost every other templates in my project. I am trying to populate my categories navigation bar with some queryset from my database but am failing with my approach. Since the base template has no url, I am finding it difficult to render. This is what I've tried:</p>
  
  <p>this is my views function</p>
  
  <pre class="lang-py prettyprint-override"><code>def base(request):
      categories = list(Category.objects.all())
      context = {
          'categories': categories
      }
      return render(request, 'ads/base.html', context)
  </code></pre>
  
  <p>this is my html</p>
  
  <pre class="lang-html prettyprint-override"><code>{% for category in categories %}
      &lt;div class="nav-item dropdown"&gt;
          &lt;a href="#" class="nav-link dropdown-toggle" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"&gt;
              { category.name }}&amp;nbsp;
              &lt;span class="float-right text-muted"&gt;
                  &lt;small&gt;
                      &lt;i class="fas fa-chevron-down"&gt;&lt;/i&gt;
                  &lt;/small&gt;
              &lt;/span&gt;
          &lt;/a&gt;
      &lt;/div&gt;
  {% endfor %}
  </code></pre>
  
  <p>I just want to populate my navbar with the categories queryset</p>