Exemple #1
0
    def get(self):
        
        # Add some guardians
        new_guardian = Guardian(guardian_id=6781,
                                firstname="A.J.",
                                preposition="van",
                                lastname="Brandsma")
        new_guardian.put()

        new_guardian = Guardian(guardian_id=6900,
                                firstname="M.",
                                lastname="Tervuure")
        new_guardian.put()
        
        # Add an event
        new_event = Event(tables=40,
                          talk_time=15)
        new_event.put()

        # Add some days to the aforementioned event
        new_day = Day(date=datetime.datetime(year=2011, month=11, day=11, hour=20, minute=00),
                      talks=12,
                      event=new_event)
        new_day.put()

        new_day = Day(date=datetime.datetime(year=2011, month=11, day=12, hour=20, minute=00),
                      talks=12,
                      event=new_event)
        new_day.put()

        new_day = Day(date=datetime.datetime(year=2011, month=11, day=13, hour=20, minute=00),
                      talks=12,
                      event=new_event)
        new_day.put()
        
        # Add an event
        new_event = Event(tables=40,
                          talk_time=15)
        new_event.put()

        # Add some days to the aforementioned event
        new_day = Day(date=datetime.datetime(year=2011, month=11, day=20, hour=19, minute=30),
                      talks=12,
                      event=new_event)
        new_day.put()

        new_day = Day(date=datetime.datetime(year=2011, month=11, day=21, hour=20, minute=00),
                      talks=12,
                      event=new_event)
        new_day.put()

        new_day = Day(date=datetime.datetime(year=2011, month=11, day=22, hour=19, minute=45),
                      talks=12,
                      event=new_event)
        new_day.put()
Exemple #2
0
        
        
        # Set random seed
        random.seed(1138)
                
        # Add an event
        event = Event(event_name="paasrapport",
                      tables=40,
                      talk_time=15)
        event.put()

        # Add some days to the aforementioned event
        day = Day(date=datetime.datetime(year=2011, month=11, day=11, hour=20, minute=00),
                      talks=12,
                      event=event)
        day.put()
        
        guardians = Guardian.all().fetch(99999999)
        samplesize = int(len(guardians)/3)
        guardians = random.sample(guardians, samplesize)
        for guardian in guardians:
            time = TimePreference()
            time.event = event
            time.guardian = guardian
            time.preference = random.randint(0, 2)
            time.save()
            days = event.days.fetch(999)
            random.shuffle(days)
            for i, day in enumerate(days):
                day_pref = DayPreference()
                day_pref.guardian = guardian