fix listing pour création de poste dans DAE
[auf_rh_dae.git] / project / dae / management / commands / dae.py
1 # -*- encoding: utf-8 -*-
2
3 import sys
4 import codecs
5 from django.core.management.base import BaseCommand
6 from project.rh import models as rh
7 from project.dae import models as dae
8
9 class 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))