from candidates.popit import PopItApiMixin, popit_unwrap_pagination

from django.core.management.base import BaseCommand

class Command(PopItApiMixin, BaseCommand):

    def handle(self, **options):
        max_person_id = -1
        for person in popit_unwrap_pagination(
                self.api.persons,
                per_page=100
        ):
            person_id = int(person['id'])
            max_person_id = max(person_id, max_person_id)
        print "Maximum person ID is:", max_person_id

Add a helper command to find the maximum person ID
Add a helper command to find the maximum person ID

This is useful if by deleting and reimporting data directly in MongoDB
the maximum person ID in the YNMP database gets out of sync: this
command returns the maximum ID, and it's then your reponsibility what to
do about that. (i.e. It doesn't update it in the database for you.)
