add_do_usuniecia_status.py
1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#-*- coding:utf-8 -*-
from django.core.management.base import BaseCommand
from accounts.models import GroupSettings
from dictionary.models import LemmaStatusType, Lemma_Status, StageOfWork
class Command(BaseCommand):
args = 'none'
help = u'Add "do usunięcia" status to tool.'
def handle(self, **options):
add_new_status()
def add_new_status():
lex_stage_of_work = StageOfWork.objects.get(sym_name=u'lexicography')
w_obrobce_status = Lemma_Status.objects.get(status=u'w obróbce')
### creating erase status type ###
erase_type, xx = LemmaStatusType.objects.get_or_create(name='erase',
sym_name='erase',
priority=25)
### creating do usuniecia status
do_usuniecia_status, xx = Lemma_Status.objects.get_or_create(status=u'do usunięcia',
abort_status=w_obrobce_status,
type=erase_type,
stage_of_work=lex_stage_of_work,
priority=25)
w_obrobce_status.next_statuses.add(do_usuniecia_status)
### lexicographers
lexicographers_setting = GroupSettings.objects.get(group__name=u'Leksykograf')
lexicographers_setting.next_statuses.add(do_usuniecia_status)
### superlexicographers
superlexicographers_setting = GroupSettings.objects.get(group__name=u'Superleksykograf')
superlexicographers_setting.next_statuses.add(do_usuniecia_status)