Beispiel #1
0
def upload(name, img_url, tags):
    picture = Picture()
    picture.name = name
    picture.img_url = img_url
    picture.tags = tags
    picture.save()
    return picture
Beispiel #2
0
def once_load_all():
    for str_tag in available_tags:
        for i in range(1, 21):
            snum = str(i)
            while len(snum) < 5:
                snum = '0' + snum

            picture = Picture()
            picture.name = snum + '-' + str_tag
            picture.img_url = '/' + snum + '-' + str_tag + '.jpg'
            picture.tags = [str_tag]
            picture.likes = random.randint(0, 666)

            picture.save()
Beispiel #3
0
  def post(self):
    try:
      name = self.request.get('name')
      university = self.request.get('university')
      course= self.request.get('course')
      
      upload = self.get_uploads()[0]
      
      picture = Picture()
      picture.image = upload.key()
      picture.name = name
      picture.name_university = university
      picture.name_course = course
      
      db.put(picture)

      self.redirect('/view_photo/%s' % upload.key())
      #self.response.out.write('TUDO FUNCIONOU OK!!!!')

    except:
      #self.redirect('/upload_failure.html')
      self.response.out.write('FALHOUUUUU FUDEUUUU!')