Beispiel #1
0
    def post(self):
        name = self.request.get('name')
        desc = self.request.get('desc')
        url = self.request.get('url')
        token = self.request.get('token')
        imageUrl = url + '&token=' + token
        correctUrl = imageUrl.replace("images/", "images%2F")
        location = self.request.get('place')
        tags = self.request.get('tagValues')
        themeName = self.request.get('theme')

        email = self.request.get('email')
        #         themeQuery = Theme.query(Theme.name == themeName)
        #         theme_id = themeQuery.fetch(keys_only=True)
        event = Events()
        event.name = name
        event.description = desc
        event.cover_image = correctUrl

        event.created_user_email = email
        #         event.theme_id = theme_id
        #event.image_urls = listOfUrls
        #event.tag = tags
        #event.cover_image = random.choice(listOfUrls)
        #         coordinates = getCoordinates(location)
        #         event.place = coordinates[0]
        #         event.lat = coordinates[1]
        #         event.long = coordinates[2]
        #         event.created_user_email = user.email()

        key = event.put()
        self.response.write('Got post request: ' + name + '  ' + desc + '  ' +
                            location + '  ' + tags + '  ' + correctUrl + ' ' +
                            email + ' ' + themeName + " " + key)
Beispiel #2
0
    def post(self):
        created_user_id = ""
        user = users.get_current_user()
        if user:
            listOfUrls = []

            i = 0
            while True:
                f = self.request.POST.get("file[{}]".format(i))
                if type(f) == type(None):
                    break
                else:
                    url = writeToGCBucket(f)
                    listOfUrls.append(url)
                    i += 1

        created_user_id = user.user_id()
        themeName = self.request.get('meetupTheme')
        meetupName = self.request.get('meetupName')
        tags = self.request.get('meetupTags[]', allow_multiple=True)
        desc = self.request.get('meetupDescription')
        location = self.request.get('location')
        coordinates = getCoordinates(location)

        themeQuery = Theme.query(Theme.name == themeName)
        theme_id = themeQuery.fetch(keys_only=True)

        event = Events()
        event.name = meetupName
        event.description = desc
        event.created_user_id = created_user_id
        event.theme_id = theme_id
        event.image_urls = listOfUrls
        event.tag = tags
        event.cover_image = random.choice(listOfUrls)
        event.place = coordinates[0]
        event.lat = coordinates[1]
        event.long = coordinates[2]
        event.created_user_email = user.email()

        key = event.put()
        self.redirect('/manageMeetups')