@@ -0,0 +1,1035 @@
+from django.core.management.base import BaseCommand%0Afrom datasets.models import *%0Aimport json%0Afrom datasets.models import Taxonomy, Dataset, Sound, TaxonomyNode%0A%0A%0Aclass Command(BaseCommand):%0A    help = 'Load false examples from json taxonomy file. Use it as python manage.py load_freesound_false_examples ' %5C%0A           'DATASET_ID PATH/TO/TAOXNOMY_FILE.json'%0A%0A    def add_arguments(self, parser):%0A        parser.add_argument('dataset_id', type=int)%0A        parser.add_argument('taxonomy_file', type=str)%0A%0A    def handle(self, *args, **options):%0A        file_location = options%5B'taxonomy_file'%5D%0A        dataset_id = options%5B'dataset_id'%5D%0A%0A        ds = Dataset.objects.get(id=dataset_id)%0A        taxonomy = ds.taxonomy%0A        data = json.load(open(file_location))%0A%0A        for d in data:%0A            node = taxonomy.get_element_at_id(d%5B'id'%5D)%0A            for ex_id in d%5B'FS_false_examples'%5D:%0A                sound = Sound.objects.get(freesound_id=ex_id)%0A                node.freesound_false_examples.add(sound)%0A            node.save()%0A

Add command load freesound false examples