def handle(self, *args, **options):
     for company in Company.objects.filter(latitude__isnull=True):
         error, formatted_address, point, raw, type = geocode(company.full_address, celery_geolocator.NOMINATIM_GEOCODER)
         if point and len(point)>1:
             company.latitude = point[0]
             company.longitude = point[1]
             company.save()
 def handle(self, *args, **options):
     for company in Company.objects.filter(latitude__isnull=True):
         error, formatted_address, point, raw, type = geocode(
             company.full_address, celery_geolocator.NOMINATIM_GEOCODER)
         if point and len(point) > 1:
             company.latitude = point[0]
             company.longitude = point[1]
             company.save()
    def handle(self, *args, **options):
        successes = 0
        for i, company in enumerate(Company.objects.all()):
            error, formatted_address, point, raw, geocode_type = geocode(company.full_address,
                                                                 celery_geolocator.NOMINATIM_GEOCODER)
            if point and len(point) > 1:
                successes += 1
                company.longitude = point[1]
                company.latitude = point[0]
                company.save()
                print company.pk

        print "successfully processed {0} of {1} companies".format(successes, i+1)
        print "DONE"
Exemple #4
0
    def handle(self, *args, **options):
        successes = 0
        for i, company in enumerate(Company.objects.all()):
            error, formatted_address, point, raw, geocode_type = geocode(
                company.full_address, celery_geolocator.NOMINATIM_GEOCODER)
            if point and len(point) > 1:
                successes += 1
                company.longitude = point[1]
                company.latitude = point[0]
                company.save()
                print company.pk

        print "successfully processed {0} of {1} companies".format(
            successes, i + 1)
        print "DONE"