export_variant.py
788 Bytes
# -*- coding: utf-8 -*-
from django.core.management import BaseCommand
from common.util import uniprint
from dictionary.models import Cell
class Command(BaseCommand):
args = '<variant name> <input file name>'
help = 'Imports variant from text file'
def handle(self, variant, **options):
raise Exception("stale code")
#export_variant(variant)
def export_variant(variant):
for c in Cell.objects.filter(table_template__variant__id=variant):
tt = c.table_template
ic = tt.inflection_characteristic
pt = tt.pattern_type
data = (variant, ic.part_of_speech.symbol, pt.symbol, ic.symbol,
'', '', '', '', c.base_form_label.symbol,
c.tag, c.prefix, c.suffix, str(c.index))
uniprint('\t'.join(data))