refactor location transfer

This commit is contained in:
alex 2020-02-04 16:01:31 +03:00
parent 11cd688851
commit 9177d41309

View File

@ -332,7 +332,7 @@ def get_unused_data():
# Add correct objects of Country, Region and City with mysql_ids array (Country, Region) and mysql_id (City) # Add correct objects of Country, Region and City with mysql_ids array (Country, Region) and mysql_id (City)
def add_correct_location_models(ruby_data): def add_correct_location_models(ruby_data):
for mysql_id, city_object in tqdm(ruby_data.items()): for mysql_id, city_object in tqdm(ruby_data.items()):
country_data = city_object["country"] country_data = city_object['country']
country_code = country_data['code'] # i.e. fr country_code = country_data['code'] # i.e. fr
try: try:
country = Country.objects.get( country = Country.objects.get(
@ -501,7 +501,6 @@ def fix_chosen_tag():
def fix_location_models(): def fix_location_models():
try: try:
ruby_data_file = open(f"{settings.PROJECT_ROOT}/apps/location/ruby_data.py", "r") ruby_data_file = open(f"{settings.PROJECT_ROOT}/apps/location/ruby_data.py", "r")
ruby_data = json.loads(ruby_data_file.read()) ruby_data = json.loads(ruby_data_file.read())