Add role transfer fix

This commit is contained in:
littlewolf 2019-11-20 14:07:45 +03:00
parent 5a3e4526c3
commit 4a26192fc9

View File

@ -9,6 +9,7 @@ from django.core.exceptions import MultipleObjectsReturned
from collection.models import Collection
from requests import get
from main.models import AwardType
from account.models import Role
def transfer_countries():
@ -410,6 +411,18 @@ def fix_award_type():
award_type.save()
def fix_role():
roles_list = Role.objects.filter(country__isnull=False)
for role in roles_list:
try:
correct_country = Country.objects.get(code=role.country.code, mysql_ids__isnull=False)
except Country.DoesNotExist:
continue
role.country = correct_country
role.save()
def fix_location_models():
# try:
@ -422,7 +435,8 @@ def fix_location_models():
#
# fix_location_address()
# fix_location_collection()
fix_award_type()
# fix_award_type()
fix_role()
data_types = {