Add tags transfer fix
This commit is contained in:
parent
cd0a14a123
commit
1b579349bf
|
|
@ -12,6 +12,7 @@ from main.models import AwardType
|
|||
from account.models import Role
|
||||
from news.models import News
|
||||
from review.models import Review
|
||||
from tag.models import TagCategory, ChosenTagSettings
|
||||
|
||||
|
||||
def transfer_countries():
|
||||
|
|
@ -449,6 +450,30 @@ def fix_reviews():
|
|||
review.save()
|
||||
|
||||
|
||||
def fix_tag_category():
|
||||
tags_categories = TagCategory.objects.filter(country__isnull=False)
|
||||
for tag_category in tags_categories:
|
||||
try:
|
||||
correct_country = Country.objects.get(code=tag_category.country.code, mysql_ids__isnull=False)
|
||||
except Country.DoesNotExist:
|
||||
continue
|
||||
|
||||
tag_category.country = correct_country
|
||||
tag_category.save()
|
||||
|
||||
|
||||
def fix_chosen_tag():
|
||||
chosen_tags = ChosenTagSettings.objects.filter(country__isnull=False)
|
||||
for chosen_tag in chosen_tags:
|
||||
try:
|
||||
correct_country = Country.objects.get(code=chosen_tag.country.code, mysql_ids__isnull=False)
|
||||
except Country.DoesNotExist:
|
||||
continue
|
||||
|
||||
chosen_tag.country = correct_country
|
||||
chosen_tag.save()
|
||||
|
||||
|
||||
def fix_location_models():
|
||||
|
||||
# try:
|
||||
|
|
@ -464,7 +489,10 @@ def fix_location_models():
|
|||
# fix_award_type()
|
||||
# fix_role()
|
||||
# fix_news()
|
||||
fix_reviews()
|
||||
# fix_reviews()
|
||||
fix_tag_category()
|
||||
fix_chosen_tag()
|
||||
|
||||
|
||||
data_types = {
|
||||
"dictionaries": [
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user