add some change for add translations for tags
This commit is contained in:
parent
9f03da9bef
commit
82c79091a3
|
|
@ -1,19 +1,17 @@
|
|||
from django.core.management.base import BaseCommand
|
||||
|
||||
from establishment.models import Establishment, EstablishmentType
|
||||
from tag.models import Tag
|
||||
from transfer import models as legacy
|
||||
from tag.models import Tag, TagCategory
|
||||
from tqdm import tqdm
|
||||
|
||||
|
||||
class Command(BaseCommand):
|
||||
help = 'Add tags translation from old db to new db'
|
||||
|
||||
def handle(self, *args, **kwargs):
|
||||
translation = legacy.MetadatumAliases.objects.all()
|
||||
# Humanisation for default values
|
||||
|
||||
def humanization_tag(self):
|
||||
"""Humanisation for default values"""
|
||||
tags = Tag.objects.all()
|
||||
for tag in tags:
|
||||
for tag in tqdm(tags):
|
||||
value = tag.label
|
||||
for k, v in value.items():
|
||||
if isinstance(v, str) and '_' in v:
|
||||
|
|
@ -22,10 +20,13 @@ class Command(BaseCommand):
|
|||
tag.label[k] = v
|
||||
tag.save()
|
||||
|
||||
for trans in translation:
|
||||
def handle(self, *args, **kwargs):
|
||||
translation = legacy.MetadatumAliases.objects.all()
|
||||
# self.humanization_tag()
|
||||
for trans in tqdm(translation):
|
||||
tag = Tag.objects.filter(value=trans.value).first()
|
||||
if tag:
|
||||
tag.label.update(
|
||||
{trans.locale: trans.meta_alias}
|
||||
)
|
||||
tag.save()
|
||||
tag.save()
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user