def import_regions(self, force):
        """
        Create region models out of the configuration.

        @param force: Should the Region settings be written if the model already exist?
        @returns: A flag indicating if the import was successful.
        """
        regions = self.store.filter_regions()
        for region in regions:
            attributes = {
                'name': region.get('id')[0:256],
                'sort_key': region.get('sort_key')
            }

            obj, created, changed, message = check_and_update(Region, overwrite=force, **attributes)

            for locale in [l[0] for l in settings.LANGUAGES]:
                po = self.poutils[locale]
                po.add_or_update(
                    msgid=u'%s short label' % attributes['name'],
                    msgstr=region.get('name') or '',
                    occurs=[(os.path.abspath(self.store.datafile), region.sourceline,)]
                )
                po.add_or_update(
                    msgid=u'%s label' % attributes['name'],
                    msgstr=region.get('label') or '',
                    occurs=[(os.path.abspath(self.store.datafile), region.sourceline,)]
                )
                po.add_or_update(
                    msgid=u'%s long description' % attributes['name'],
                    msgstr=region.get('description') or '',
                    occurs=[(os.path.abspath(self.store.datafile), region.sourceline,)]
                )

            if changed and not force:
                logger.info(message)
            else:
                logger.debug(message)

        return True
dataset/ETHPy150Open PublicMapping/DistrictBuilder/django/publicmapping/redistricting/config.py/ConfigImporter.import_regions/original