title: How to retrieve previous/next entry in a Django DetailView view
body: <p>I'm using a class based view DetailView to handle the layout of a blog post. </p>
  
  <p>In the template, I need to implement a button to show previous/next posts ordered by timestamp. For this reason, I need to override the context by customising the <code>get_context_data(self)</code> method.
  In the context I thus need to add the instances of prev/next entries by <code>insertion_date</code> relative to current post.</p>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>class EntryDetailView(DetailView):
      model = Entry
  
      def get_context_data(self, **kwargs):
          context = super(EntryDetailView, self).get_context_data(**kwargs)
          context['base_url'] = self.request.build_absolute_uri("/").rstrip("/")
  
          return context
  </code></pre>
  
  <p><strong>models.py</strong></p>
  
  <pre><code>from .managers import EntryManager
  
  class Entry(models.Model):
      """ Blog Entry
      """
      insertion_date = models.DateTimeField('inserimento', auto_now_add=True)
  </code></pre>
  
  <p>Thank you for any help you could provide.</p>