""" Retire les espaces contenu dans le champ "notation" et "simplified notation" de la class skill dans le but de faciliter les recherches (skill_lookup). """ from django.core.management.base import BaseCommand from jarvis.objective.models import Skill class Command(BaseCommand): def handle(self, *args, **options): skill_list = Skill.objects.all() for skill in skill_list: need_update = False notation = skill.notation.replace(" ", "") simplified_notation = skill.simplified_notation.replace(" ", "") if notation != skill.notation: need_update = True skill.notation = notation if simplified_notation != skill.simplified_notation: need_update = True skill.simplified_notation = simplified_notation if need_update: skill.save()