Project

General

Profile

Download (1004 Bytes) Statistics
| Branch: | Tag: | Revision:
#!/usr/bin/env python

"""
Shuffle nom et prenom
"""

import django.core.management
import calebasse.settings

django.core.management.setup_environ(calebasse.settings)

import random
from calebasse.actes.models import Act
from calebasse.agenda.models import Event
from calebasse.dossiers.models import PatientRecord
from calebasse.personnes.models import People

last = []
first = []
random.seed()
for p in People.objects.all():
if p.last_name:
last.append(p.last_name)
if p.first_name:
first.append(p.first_name)

len_first = len(first) - 1
len_last = len(last) - 1

for p in People.objects.all():
i = random.randint(0, len_last)
p.last_name = last[i]
if len(p.last_name) > 5:
p.last_name = p.last_name[:-2] + 'zz'
i = random.randint(0, len_first)
p.first_name = first[i]
p.save()

PatientRecord.objects.all().update(social_security_id="3999999999999", comment="")
Event.objects.all().update(description="")
Act.objects.all().update(comment="")

(9-9/16)