You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
1.1 KiB
28 lines
1.1 KiB
from django.contrib.auth.models import Group, Permission
|
|
from django.contrib.contenttypes.models import ContentType
|
|
from django.core.management import BaseCommand
|
|
from django.utils import timezone
|
|
import pydash as _; _.map = _.map_; _.filter = _.filter_
|
|
import random
|
|
|
|
from archilance import util
|
|
from common.models import Location
|
|
|
|
|
|
class Command(BaseCommand):
|
|
def handle(self, *args, **options):
|
|
print('---------------------------------------')
|
|
print('Generating locations...')
|
|
print('---------------------------------------')
|
|
|
|
|
|
_root = Location.objects.create(name='_root', type='_root')
|
|
|
|
depths = ('A','B','C','D')
|
|
|
|
for d1 in depths:
|
|
x = Location.objects.create(name='Страна %s' % d1, type='country', parent=_root)
|
|
for d2 in depths:
|
|
y = Location.objects.create(name='Регион %s-%s' % (d1,d2), type='region', parent=x)
|
|
for d3 in depths:
|
|
z = Location.objects.create(name='Город %s-%s-%s' % (d1,d2,d3), type='town', parent=y)
|
|
|