title: Multiple models generic DetailView to template
body: <p>I have 2 models and I got the <code>IndexView</code> working properly using the <code>get_context_data</code> method. However my <code>DetailView</code> using the same technique is not working. How do I simply get 2 models into the <code>DetailView</code>?</p>
  
  <p>views.py</p>
  
  <pre><code>from .models import CharacterSeries, CharacterUniverse
  
  
  class IndexView(generic.ListView):
      template_name = 'character/index.html'
      context_object_name = 'character_series_list'
  
      def get_queryset(self):
          return CharacterSeries.objects.order_by('name')
  
      def get_context_data(self, **kwargs):
          context = super(IndexView, self).get_context_data(**kwargs)
          context['character_universe_list'] = CharacterUniverse.objects.order_by('name')
          return context
  
  
  class DetailView(generic.DetailView):
      model = CharacterSeries
      template_name = 'character/detail.html'
  
      def get_context_data(self, **kwargs):
          context = super(DetailView, self).get_context_data(**kwargs)
          context['character_universe_list'] = CharacterUniverse.objects.all()
          return context
  </code></pre>
  
  <p>I am missing something; I need to get <code>CharacterUniverse</code> into the DetailView. I have tried using <a href="https://docs.djangoproject.com/en/1.8/topics/class-based-views/generic-display/#making-friendly-template-contexts" rel="noreferrer">this page</a>'s information to no avail.</p>
  
  <p>Thanks all.</p>
  
  <p><strong>UPDATE:</strong></p>
  
  <p>detail.html</p>
  
  <pre><code>&lt;ul&gt;
  {% for series in characterseries.character_set.all %}
      &lt;li&gt;{{ series.name }}&lt;/li&gt;
  {% endfor %}
  &lt;/ul&gt;
  
  &lt;ul&gt;
  {% for universe in characteruniverse.character_set.all %}
      &lt;li&gt;{{ universe.name }}&lt;/li&gt;
  {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  
  <p>index.html</p>
  
  <pre><code>{% load staticfiles %}
  
  &lt;link rel ="stylesheet" type="text/css" href="{% static 'character/style.css' %}" /&gt;
  
  &lt;h1&gt;Character Series&lt;/h1&gt;
  
  &lt;ul&gt;
    {% for character_series in character_series_list %}  {# for MODEL in .. #}
      &lt;li&gt;&lt;a href="{% url 'character:detail' character_series.pk %}"&gt;{{ character_series.name }}&lt;/a&gt;&lt;/li&gt;
    {% endfor %}
  &lt;/ul&gt;
  
  &lt;h1&gt;Character Universe&lt;/h1&gt;
  
  &lt;ul&gt;
    {% for character_universe in character_universe_list %}  {# for MODEL in .. #}
      &lt;li&gt;&lt;a href="{% url 'character:detail' character_universe.pk %}"&gt;{{ character_universe.name }}&lt;/a&gt;&lt;/li&gt;
    {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  
  <p><strong>An example from the official documentation: This is not possible in my case?</strong></p>
  
  <pre><code>from django.views.generic import DetailView
  from books.models import Publisher, Book
  
  class PublisherDetail(DetailView):
  
      model = Publisher
  
      def get_context_data(self, **kwargs):
          # Call the base implementation first to get a context
          context = super(PublisherDetail, self).get_context_data(**kwargs)
          # Add in a QuerySet of all the books
          context['book_list'] = Book.objects.all()
          return context
  </code></pre>
  
  <p>Perhaps this is the final solution? This is not working though.. Naming wrong?</p>
  
  <hr>
  
  <p><strong><em>ALL THE UPDATES</em></strong></p>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>from django.shortcuts import get_object_or_404, render
  from django.views import generic
  from django.views.generic import DetailView
  from .models import CharacterSeries, CharacterUniverse
  
  
  class IndexView(generic.ListView):
      template_name = 'character/index.html'
      context_object_name = 'character_series_list'
  
      def get_queryset(self):
          return CharacterSeries.objects.order_by('name')
  
      def get_context_data(self, **kwargs):
          context = super(IndexView, self).get_context_data(**kwargs)
          context['character_universe_list'] = CharacterUniverse.objects.order_by('name')
          return context
  
  
  class SeriesDetail(DetailView):
      model = CharacterSeries
      template_name = 'character/series_detail.html'
  
  class UniverseDetail(DetailView):
      model = CharacterUniverse
      template_name = 'character/universe_detail.html'
  </code></pre>
  
  <p><strong>urls.py</strong></p>
  
  <pre><code>from django.conf.urls import url
  
  from . import views
  
  urlpatterns = [
      url(r'^$', views.IndexView.as_view(), name='index'),
      url(r'^(?P&lt;pk&gt;[0-9]+)/$', views.SeriesDetail.as_view(), name='series_detail'),
      url(r'^(?P&lt;pk&gt;[0-9]+)/$', views.UniverseDetail.as_view(), name='universe_detail'),
  ]
  </code></pre>
  
  <p><strong>index.html</strong></p>
  
  <pre><code>{% load staticfiles %}
  
  &lt;link rel ="stylesheet" type="text/css" href="{% static 'character/style.css' %}" /&gt;
  
  &lt;h1&gt;Character Series&lt;/h1&gt;
  
  &lt;ul&gt;
    {% for character_series in character_series_list %}
      &lt;li&gt;&lt;a href="{% url 'character:series_detail' character_series.pk %}"&gt;{{ character_series.name }}&lt;/a&gt;&lt;/li&gt;
    {% endfor %}
  &lt;/ul&gt;
  
  &lt;h1&gt;Character Universe&lt;/h1&gt;
  
  &lt;ul&gt;
    {% for character_universe in character_universe_list %}
      &lt;li&gt;&lt;a href="{% url 'character:universe_detail' character_universe.pk %}"&gt;{{ character_universe.name }}&lt;/a&gt;&lt;/li&gt;
    {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  
  <p><strong>series_detail.html</strong></p>
  
  <pre><code>&lt;ul&gt;
  {% for series in characterseries.character_set.all %}
      &lt;li&gt;{{ series.name }}&lt;/li&gt;
  {% endfor %}
  &lt;/ul&gt;
  </code></pre>
  
  <p><strong>universe_detail.html</strong></p>
  
  <pre><code>&lt;ul&gt;
  {% for universe in characteruniverse.character_set.all %}
      &lt;li&gt;{{ universe.name }}&lt;/li&gt;
  {% endfor %}
  &lt;/ul&gt;
  </code></pre>