from edgware.editor.models import *

def do():
  for a in Article.objects.all():
    pages = a.page_set.all().order_by('page_no')
    x = 1
    for p in pages:
      p.page_no = x
      p.save()
      x = x + 1

