def test_clear_text(self): """Should remove combining marks from text""" sp = utils.clear_text('São Paulo') rand = utils.clear_text('ç~ã`é´â^ô') self.assertEqual('Sao Paulo', sp) self.assertEqual('caeao', rand)
def test_clear_text(self): """Should remove combining marks from text""" sp = utils.clear_text("São Paulo") rand = utils.clear_text("ç~ã`é´â^ô") self.assertEqual("Sao Paulo", sp) self.assertEqual("caeao", rand)
def migrate_cities(apps, scheme_editor): """Updates the city based on the new model""" Pet = apps.get_model('meupet', 'Pet') City = apps.get_model('cities', 'City') for pet in Pet.objects.all(): if pet.city: city = City.objects.filter(search_name=utils.clear_text(pet.city.city).lower()).first() if city: pet.new_city = city pet.save()
def migrate_cities(apps, scheme_editor): """Updates the city based on the new model""" Pet = apps.get_model('meupet', 'Pet') City = apps.get_model('cities', 'City') for pet in Pet.objects.all(): if pet.city: city = City.objects.filter( search_name=utils.clear_text(pet.city.city).lower()).first() if city: pet.new_city = city pet.save()
def save(self, *args, **kwargs): self.search_name = utils.clear_text(self.name).lower() super(City, self).save(*args, **kwargs)
def get_city(self, name): clean_name = utils.clear_text(name).lower() return self.filter(search_name=clean_name)
def save(self, *args, **kwargs): self.search_name = utils.clear_text(self.name).lower() super(City, self).save(*args, **kwargs)