title: If page is unpublished go to the next available page
body: <p>I'm creating a webcomic using Django. I have a status choice field in my model: 1 to publish a page and 0 to unpublish it.</p>
  <pre><code>STATUS = (
  (0,&quot;Draft&quot;),
  (1,&quot;Publish&quot;))
  </code></pre>
  <p>I have created two functions: the first one to go to the previous page and the second one to go to the next page.</p>
  <pre><code>def get_previous(self):
      previous = Page.objects.filter(status=1).get(number=self.number - 1)
      if previous.number &gt; 0:
          return reverse('comic_page', args=[previous.chapter.slug, previous.number])
      return None
  
  def get_next(self):
      last = Page.objects.filter(status=1).last()
      next = Page.objects.filter(status=1).get(number=self.number + 1)
      if next.number &lt;= last.number:
          return reverse('comic_page', args=[next.chapter.slug, next.number])
      return None
  </code></pre>
  <p>It works as expected when all the pages are published, but when one of the pages is unpublished it doesn't go to the next available page but just refreshes the page.</p>
  <p>I tried creating another queryset with only unpublished pages and then checking if the page exists in that queryset and jumping 2 page numbers instead of 1 but it did not work.</p>
  <pre><code>def get_previous(self):
      previous = Page.objects.filter(status=1).get(number=self.number - 1)
      unpublished = Page.objects.filter(status=0)
      if previous in unpublished:
          previous = Page.objects.filter(status=1).get(number=self.number - 2)
          return reverse('comic_page', args=[previous.chapter.slug, previous.number])
  
      if previous.number &gt; 0:
          return reverse('comic_page', args=[previous.chapter.slug, previous.number])
      return None
  </code></pre>
  <p>Any suggestions are appreciated, thank you!</p>