title: moving items of list up and down
body: <p>Let's say we have a list of items. And, we want to allow users to control their order by clicking (down-arrow) to lower the order of item one level. And, doing the same to set the order one level higher.</p>
  
  <p><strong>views.py</strong></p>
  
  <pre><code>def item_up(request, item_id):
      item = get_object_or_404(Item, id=item_id)
      swap_order = item.order - 1
      swap = get_object_or_404(Item, order=swap_order)
      item.order += 1000
      item.save()
      swap.order += 1
      item.order -= 1001
      swap.save()
      item.save()
      return redirect(request.META['HTTP_REFERER'])
  
  def item_down(request, item_id):
      item = get_object_or_404(Item, id=item_id)
      swap_order = item.order + 1
      swap = get_object_or_404(Item, order=swap_order)
      item.order -= 1000
      item.save()
      swap.order -= 1
      item.order += 1001
      swap.save()
      item.save()
      return redirect(request.META['HTTP_REFERER'])
  </code></pre>
  
  <p>this way is working except when I have only two items it shows me an error.</p>
  
  <pre><code>No Item matches the given query.
  </code></pre>
  
  <p>Any Idea?</p>