Routeur: Ajout temporaire des modules workflow et dae en écriture
[auf_rh_dae.git] / project / dae / management / commands / dae.py
CommitLineData
9c1ff333
OL
1# -*- encoding: utf-8 -*-
2
3import sys
4import codecs
5from django.core.management.base import BaseCommand
6from project.rh import models as rh
7from project.dae import models as dae
8
9class Command(BaseCommand):
10
11 def handle(self, *args, **options):
12
13 stdout = options.get('stdout', sys.stdout)
14 self.stdout = codecs.getwriter('utf8')(stdout)
15
16 if args[0] == "liste_poste":
17 for poste in dae.Poste.objects.filter(id_rh__isnull=False):
18 self.stdout.write(u"%s: %s %s [%s]\n" % (poste.id, poste.nom,
19 poste.implantation, poste.etat))
20
21 if args[0] == "importer_poste":
22 poste = dae.Poste.objects.get(id=args[1])
23 poste.importer_dans_rh()
24 self.stdout.write(u"DAE:%s => RH:%s\n" % (poste.id, poste.id_rh.id))