connect_frames_to_entries.py 595 Bytes
#! /usr/bin/python
# -*- coding: utf-8 -*-

import sys, os, codecs

from django.core.management.base import BaseCommand

from dictionary.models import Entry
from semantics.models import SemanticFrame
from settings import PROJECT_PATH

class Command(BaseCommand):
    args = 'none'
    help = ''

    def handle(self, **options):
        connect_frames()

def connect_frames():
    entries = Entry.objects.all()
    for entry in entries:
        frames = entry.actual_frames()
        for frame in frames:
            frame.entry = entry
            frame.save()