title: Django Query find most recent item in past or future
body: <p>I have a query working for returning the item closest to the current date and furthest from the current date. I would like to change the query to find the closest date in the future and the closest date in the past. Is there a way to limit results to only return prior or future dates?</p>
  
  <p>My current query looks like this:</p>
  
  <pre><code>next = Product.objects.all().filter(categories__name='Subscription').filter(name__gt=date.today()).order_by("name")[0]
  current = Product.objects.all().filter(categories__name='Subscription').filter(name__gt=date.today()).order_by("-name")[0]
  </code></pre>