David Barragan  committed a0325ea

Now it run a geolocalize task when a non geolocalized entity will be import

  • Participants
  • Parent commits 7f0bf2d

Comments (0)

Files changed (1)

File src/macadjan_base/importer/

 from django.utils.translation import ugettext as _
 from macadjan_base import models
+from macadjan_base.async_tasks import task__geolocalize_entity
 class EntityImporter:
     An object that can import entities from an archive and a converter.
                 self.process_exception(_(u'Error cerrando el archivo'), ex)
     def process_item(self, item):
-        slug = self.converter.get_slug_from_item(item)
+        slug = self.converter.get_slug_from_item()
             entity = models.Entity.objects.get(slug = slug)
         except models.Entity.DoesNotExist:
             entity = models.Entity()
         (entity, m2m) = self.converter.load_entity_from_item(entity, item) = False)
+        if not entity.latirude or not entity.longitude:
+            task__geolocalize_entity.delay(    
         for subcategory in m2m['subcategories']: