#! /usr/bin/python # -*- coding: utf-8 -*- from django.core.management.base import BaseCommand from settings import PROJECT_PATH from semantics.models import FrameOpinion OPINIONS = [(70, u'met', u'metaforyczna'), (60, u'vul', u'wulgarna'), (50, u'col', u'potoczna'), (40, u'dat', u'archaiczna'), (30, u'bad', u'zła'), (20, u'unc', u'wątpliwa'), (10, u'cer', u'pewna')] #==========================================================# class Command(BaseCommand): args = 'none' help = '' def handle(self, **options): import_opinions() def import_opinions(): opinions = [] for priority, short, value in OPINIONS: o=FrameOpinion(value=value, short=short, priority=priority) opinions.append(o) FrameOpinion.objects.bulk_create(opinions)