title: Send context the template in a class based view
body: <p>How can I send context to my template in a class-based view with the <code>get_object</code> function?</p>
  <p>This is my class:</p>
  <pre><code>class DetailMessages(LoginRequiredMixin, DetailView, ChannelFormMixin):
      template_name = 'DM/chat.html'
      def get_object(self, *args, **kwargs):
          my_username = self.request.user.username
          username = self.kwargs.get(&quot;username&quot;)
          channel, _ = Channel.objects.get_dm_channel(my_username, username)
          if channel == None:
              raise Http404
          context = {&quot;example1&quot; : &quot;I want this on the template&quot;, &quot;example2&quot; : &quot;I want this on the template too&quot;}
          return channel
  </code></pre>