Add news transfer

This commit is contained in:
littlewolf 2019-11-20 19:40:04 +03:00
parent 4a26192fc9
commit aa6d88772d

View File

@ -10,6 +10,7 @@ from collection.models import Collection
from requests import get
from main.models import AwardType
from account.models import Role
from news.models import News
def transfer_countries():
@ -423,6 +424,18 @@ def fix_role():
role.save()
def fix_news():
news = News.objects.filter(country__isnull=False)
for news_item in news:
try:
correct_country = Country.objects.get(code=news_item.country.code, mysql_ids__isnull=False)
except Country.DoesNotExist:
continue
news.country = correct_country
news.save()
def fix_location_models():
# try:
@ -436,8 +449,8 @@ def fix_location_models():
# fix_location_address()
# fix_location_collection()
# fix_award_type()
fix_role()
# fix_role()
pass
data_types = {
"dictionaries": [