Revision a6be71ef
Added by Jérôme Schneider almost 11 years ago
anonimize.py | ||
---|---|---|
10 | 10 |
django.core.management.setup_environ(calebasse.settings) |
11 | 11 |
|
12 | 12 |
import random |
13 |
|
|
14 |
from random import randint |
|
15 |
|
|
13 | 16 |
from calebasse.actes.models import Act |
14 | 17 |
from calebasse.agenda.models import Event |
15 | 18 |
from calebasse.dossiers.models import PatientRecord |
... | ... | |
24 | 27 |
last.append(p.last_name) |
25 | 28 |
if p.first_name: |
26 | 29 |
first.append(p.first_name) |
27 |
|
|
28 | 30 |
len_first = len(first) - 1 |
29 | 31 |
len_last = len(last) - 1 |
30 |
|
|
31 | 32 |
for p in People.objects.all(): |
32 |
i = random.randint(0, len_last) |
|
33 |
p.last_name = last[i] |
|
33 |
p.last_name = last[randint(0, len_last)] |
|
34 | 34 |
if len(p.last_name) > 5: |
35 | 35 |
p.last_name = p.last_name[:-2] + 'zz' |
36 |
i = random.randint(0, len_first) |
|
37 |
p.first_name = first[i] |
|
36 |
p.first_name = first[randint(0, len_first)] |
|
38 | 37 |
p.save() |
38 |
if hasattr(p, "worker"): |
|
39 |
p.worker.initials = p.worker.get_initials() |
|
40 |
p.worker.save() |
|
39 | 41 |
|
40 | 42 |
PatientRecord.objects.all().update(social_security_id="3999999999999", comment="") |
41 | 43 |
Event.objects.all().update(description="") |
42 | 44 |
Act.objects.all().update(comment="") |
43 |
PatientAddress.objects.all().update(comment="", phone="03%d%d040404" % (random.ranint(0, 9), ranint.ranint(0, 9)), street="rue du poulpe") |
|
45 |
PatientAddress.objects.all().update(comment="", |
|
46 |
phone="03%d%d040404" % (randint(0, 9), randint(0, 9)), |
|
47 |
street="rue du poulpe") |
|
44 | 48 |
|
Also available in: Unified diff
anonimize.py: cleanning