1 # -*- encoding: utf-8 -*-
5 from django
.core
.management
.base
import BaseCommand
6 from project
.rh
import models
as rh
7 from project
.dae
import models
as dae
9 class Command(BaseCommand
):
11 def handle(self
, *args
, **options
):
13 stdout
= options
.get('stdout', sys
.stdout
)
14 self
.stdout
= codecs
.getwriter('utf8')(stdout
)
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
))
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))