def countreis(): print '\n' print 'Import/Update Country' base, prog = get_data() for row in base: try: country = Country.objects(name_eu = row[3])[0] except: country = Country(name_eu = row[3]) country.name_ru = row[3] country.slug = '%s' % (str(row[3]).replace(' ','_')) country.save() prog.increment_amount() print prog, '\r', sys.stdout.flush()