update_semantic_frames.py 577 Bytes
#! /usr/bin/python
# -*- coding: utf-8 -*-

from django.core.management.base import BaseCommand
from settings import PROJECT_PATH

from semantics.models import SemanticFrame, Complement

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

    def handle(self, **options):
        update_semantic_frames()
        
def update_semantic_frames():
    frames = SemanticFrame.objects.all()
    for frame in frames:
        frame.complements = Complement.objects.filter(frame__id=frame.id)
        frame.save()