# Path: cities/conf.py
# ALTERNATIVE_NAME_TYPES = getattr(django_settings, 'CITIES_ALTERNATIVE_NAME_TYPES', _ALTERNATIVE_NAME_TYPES)
# 
# SLUGIFY_FUNCTION = getattr(import_module(module_name), function_name)
# 
# DJANGO_VERSION = float('.'.join(map(str, django.VERSION[:2])))
# 
# Path: cities/managers.py
# class AlternativeNameManager(models.Manager):
#     def get_queryset(self):
#         return super(AlternativeNameManager, self).get_queryset().exclude(kind='link')
# 
# Path: cities/util.py
# def geo_distance(a, b):
# def add_continents(continent_model):
# def default_slugify(obj, value):
# def patterns(prefix, *args):


from random import choice
from string import ascii_uppercase, digits
    from django.utils.encoding import force_unicode as force_text
    from django.utils.encoding import force_text
from django.db import transaction
from django.contrib.gis.db.models import PointField
from django.db import models
from django.contrib.gis.geos import Point
from model_utils import Choices
from .conf import (ALTERNATIVE_NAME_TYPES, SLUGIFY_FUNCTION, DJANGO_VERSION)
from .managers import AlternativeNameManager
from .util import unicode_func
    from django.contrib.gis.db.models import GeoManager
    from django.db.models import Manager as GeoManager
import swapper
    def full_code(self):
        return unicode_func(".".join([self.parent.code, self.code]))

    def slugify(self):
        return '{}_({})'.format(
            unicode_func(self.name),
            unicode_func(self.full_code()))


class Subregion(Place, SlugModel):
    slug_contains_id = True

    name_std = models.CharField(max_length=200, db_index=True, verbose_name="standard name")
    code = models.CharField(max_length=200, db_index=True)
    region = models.ForeignKey(Region,
                               related_name='subregions',
                               on_delete=SET_NULL_OR_CASCADE)

    class Meta:
        unique_together = (('region', 'id', 'name'),)

    @property
    def parent(self):
        return self.region

    def full_code(self):
        return ".".join([self.parent.parent.code, self.parent.code, self.code])

    def slugify(self):
        return unicode_func('{}-{}').format(

# Path: cities/conf.py
# ALTERNATIVE_NAME_TYPES = getattr(django_settings, 'CITIES_ALTERNATIVE_NAME_TYPES', _ALTERNATIVE_NAME_TYPES)
# 
# SLUGIFY_FUNCTION = getattr(import_module(module_name), function_name)
# 
# DJANGO_VERSION = float('.'.join(map(str, django.VERSION[:2])))
# 
# Path: cities/managers.py
# class AlternativeNameManager(models.Manager):
#     def get_queryset(self):
#         return super(AlternativeNameManager, self).get_queryset().exclude(kind='link')
# 
# Path: cities/util.py
# def geo_distance(a, b):
# def add_continents(continent_model):
# def default_slugify(obj, value):
# def patterns(prefix, *args):


# Path: cities/models.py
from random import choice
from string import ascii_uppercase, digits
    from django.utils.encoding import force_unicode as force_text
    from django.utils.encoding import force_text
from django.db import transaction
from django.contrib.gis.db.models import PointField
from django.db import models
from django.contrib.gis.geos import Point
from model_utils import Choices
from .conf import (ALTERNATIVE_NAME_TYPES, SLUGIFY_FUNCTION, DJANGO_VERSION)
from .managers import AlternativeNameManager
from .util import unicode_func
    from django.contrib.gis.db.models import GeoManager
    from django.db.models import Manager as GeoManager
import swapper

    def full_code(self):
        return unicode_func(".".join([self.parent.code, self.code]))

    def slugify(self):
        return '{}_({})'.format(
            unicode_func(self.name),
            unicode_func(self.full_code()))


class Subregion(Place, SlugModel):
    slug_contains_id = True

    name_std = models.CharField(max_length=200, db_index=True, verbose_name="standard name")
    code = models.CharField(max_length=200, db_index=True)
    region = models.ForeignKey(Region,
                               related_name='subregions',
                               on_delete=SET_NULL_OR_CASCADE)

    class Meta:
        unique_together = (('region', 'id', 'name'),)

    @property
    def parent(self):
        return self.region

    def full_code(self):
        return ".".join([self.parent.parent.code, self.parent.code, self.code])

    def slugify(self):
        return unicode_func('{}-{}').format(

            unicode_func(self.id),