Example #1
0
	def get(self):
		guestbook_name = self.request.get('guestbook_name', DEFAULT_GUESTBOOK_NAME)
		submissions_query = Submission.query(
		ancestor=guestbook_key(guestbook_name)).order(-Submission.date)
		num_submissions = 1000
		submissions = submissions_query.fetch(num_submissions)
		self.render('guestbook.html', submissions=submissions, page_name="submissions")
    def post(self):
        guestbook_name = self.request.get('guestbook_name',
                                          DEFAULT_GUESTBOOK_NAME)
        submission = Submission(parent=guestbook_key(guestbook_name))
        submission.name = self.request.get('name')
        submission.link = self.request.get('link')
        submission.description = self.request.get('description')
        submission.image_url = self.request.get('image_url')

        query_params = {
            "guestbook_name": guestbook_name,
            "name": submission.name,
            "link": submission.link,
            "description": submission.link,
            "image_url": submission.image_url,
            "secret_key": self.request.get("secret_key")
        }

        is_valid, errors = validate_submission(submission,
                                               self.request.get('secret_key'))
        if is_valid:
            submission.put()
            self.redirect('/student_submissions/')
        else:
            for k, v in errors.items():
                query_params[k] = v
            self.get(**query_params)
 def get(self):
     guestbook_name = self.request.get('guestbook_name',
                                       DEFAULT_GUESTBOOK_NAME)
     submissions_query = Submission.query(
         ancestor=guestbook_key(guestbook_name)).order(-Submission.date)
     submissions = submissions_query.fetch(10)
     self.render('guestbook.html',
                 submissions=submissions,
                 page_name="submissions")
Example #4
0
	def post(self):
		guestbook_name = self.request.get('guestbook_name', DEFAULT_GUESTBOOK_NAME)
		submission = Submission(parent=guestbook_key(guestbook_name))
		submission.name = self.request.get('name')
		submission.link = self.request.get('link')
		submission.user_comment = self.request.get('user_comment')

		query_params = {"guestbook_name" : guestbook_name,
						"name": submission.name,
						"link":submission.link,
						"user_comment":submission.link,
						}

		is_valid, errors = validate_submission(submission, self.request.get(''))

		if is_valid:
			submission.put()
			self.redirect('/comments_section/')
		else:
			for k, v in errors.items():
				query_params[k] = v
			self.get(**query_params)
	def post(self):
		guestbook_name = self.request.get('guestbook_name', DEFAULT_GUESTBOOK_NAME)
		submission = Submission(parent=guestbook_key(guestbook_name))
		submission.name = self.request.get('name')
		submission.link = self.request.get('link')
		submission.description = self.request.get('description')
		submission.image_url = self.request.get('image_url')

		query_params = {"guestbook_name" : guestbook_name,
										"name": submission.name,
										"link":submission.link,
										"description":submission.link,
										"image_url":submission.image_url,
										"secret_key" : self.request.get("secret_key") }

		is_valid, errors = validate_submission(submission, self.request.get('secret_key'))
		if is_valid:
			submission.put()
			self.redirect('/student_submissions/')
		else:
			for k, v in errors.items():
				query_params[k] = v
			self.get(**query_params)