adjectives_todo.py
918 Bytes
#! /usr/bin/python
# -*- coding: utf-8 -*-
from django.core.management.base import BaseCommand
from django.core.exceptions import ObjectDoesNotExist
from dictionary.models import Entry, POS
REL_POS = 'noun'
REL_STATUS = '(S) sprawdzone'
class Command(BaseCommand):
args = 'none'
help = ''
def handle(self, **options):
adj_todo()
def adj_todo():
adj = POS.objects.get(tag='adj')
entries = Entry.objects.filter(pos=adj).order_by('name')
for entry in entries:
try:
entry.actual_lemma()
except ObjectDoesNotExist:
continue
rel_entries = entry.rel_entries.filter(pos__tag=REL_POS)
for rel_entry in rel_entries:
if rel_entry.actual_lemma().status.status == REL_STATUS:
print entry.name, ' ', entry.actual_lemma().status.status, '\t->\t', rel_entry.name, ' ', rel_entry.actual_lemma().status.status