Exemplo n.º 1
0
 def testItem(self):
     name = "test"
     email ="*****@*****.**"
     user = User(name=name, email=email, password="******")
     user.put()
     
     Item(user=user, name="item1", content="content1").put()
     Item(user=user, name="item2", content="content2").put()
     
     self.assertEqual(len(Item.all().fetch(10)), 2)
     self.assertEqual(len(user.items.fetch(10)), 2)
Exemplo n.º 2
0
 def create(user, form):
     ranking = Ranking(user=user,
                       title=form.title,
                       number_of_votes=0,
                       number_of_likes=0)
     ranking.put()
     vote = Vote(ranks=form.ranks, user=user, parent=ranking)
     vote.put()
     ranking.update(vote)
     for (name, content) in zip(form.item_names, form.item_contents):
         Item(parent=ranking, user=user, name=name, content=content).put()
     return ranking
Exemplo n.º 3
0
 def get_items(self):
     return [item for item in Item.all().ancestor(self)]
Exemplo n.º 4
0
 def get_items(self):
     return [item for item in Item.all().ancestor(self)]