Esempio n. 1
0
def setUp(self):
    etunimet = ["Jonne", "Krista", "Sakari", "Jeesus", "��kk�shirvi�"]
    sukunimet = ["Airaksinen", "Von Castrenius", "Kristus", "Ulina", "Kulli"]
    gender = ["M","F"]
    for i in range(0,100):
        p = Person()
        p.first_name = etunimet[random.randint(0,len(etunimet)-1)]
        p.last_name = sukunimet[random.randint(0,len(sukunimet)-1)]
        p.birth_date = datetime.date(random.randint(1800,2000),random.randint(1,12),random.randint(1,28))
        p.gender = gender[random.randint(0,1)]
        p.save()
    print Person.objects.all()
            
            
        
Esempio n. 2
0
 def handle(self, *args, **options):
     etunimet = ["Jonne", "Krista", "Sakari", "Jeesus", "Ääkköshirviö"]
     sukunimet = ["Airaksinen", "Von Castrenius", "Kristus", "Ulina", "Kulli"]
     gender = ["M","F"]
     f = Person()
     f.first_name = "Isä"
     f.last_name = "Iso"
     f.birth_date = datetime.date(1800,1,1)
     f.gender = "M"
     f.father = 0
     f.mother = 0
     
     
     m = Person()
     m.first_name = "Äiti"
     m.last_name = "Iso"
     m.birth_date = datetime.date(1800,1,1)
     m.gender = "F"
     m.father = 0
     m.mother = 0
     m.marriage.set(f)
     f.marriage.set(m)
     f.children
     f.save()
     m.save()
     '''
     for i in range(0,100):
         p = Person()
         p.first_name = etunimet[random.randint(0,len(etunimet)-1)]
         p.last_name = sukunimet[random.randint(0,len(sukunimet)-1)]
         p.birth_date = datetime.date(random.randint(1800,2000),random.randint(1,12),random.randint(1,28))
         p.gender = gender[random.randint(0,1)]
         p.father = 0
         p.mother = 0
         p.save()
     '''
     print serializers.serialize("json", Person.objects.all())
     print Person.objects.all()
 
 #def create_childern(self,mother,father):