1
|
#!/usr/bin/env python
|
2
|
|
3
|
"""
|
4
|
Shuffle nom et prenom
|
5
|
"""
|
6
|
|
7
|
import django.core.management
|
8
|
import calebasse.settings
|
9
|
|
10
|
django.core.management.setup_environ(calebasse.settings)
|
11
|
|
12
|
import random
|
13
|
|
14
|
from random import randint
|
15
|
|
16
|
from calebasse.actes.models import Act
|
17
|
from calebasse.agenda.models import Event
|
18
|
from calebasse.dossiers.models import PatientRecord
|
19
|
from calebasse.dossiers.models import PatientAddress
|
20
|
from calebasse.personnes.models import People
|
21
|
|
22
|
last = []
|
23
|
first = []
|
24
|
random.seed()
|
25
|
for p in People.objects.all():
|
26
|
if p.last_name:
|
27
|
last.append(p.last_name)
|
28
|
if p.first_name:
|
29
|
first.append(p.first_name)
|
30
|
len_first = len(first) - 1
|
31
|
len_last = len(last) - 1
|
32
|
for p in People.objects.all():
|
33
|
p.last_name = last[randint(0, len_last)]
|
34
|
if len(p.last_name) > 5:
|
35
|
p.last_name = p.last_name[:-2] + 'zz'
|
36
|
p.first_name = first[randint(0, len_first)]
|
37
|
p.save()
|
38
|
if hasattr(p, "worker"):
|
39
|
p.worker.initials = p.worker.get_initials()
|
40
|
p.worker.save()
|
41
|
|
42
|
PatientRecord.objects.all().update(social_security_id="3999999999999", comment="")
|
43
|
Event.objects.all().update(description="")
|
44
|
Act.objects.all().update(comment="")
|
45
|
PatientAddress.objects.all().update(comment="",
|
46
|
phone="03%d%d040404" % (randint(0, 9), randint(0, 9)),
|
47
|
street="rue du poulpe")
|
48
|
|