Exemple #1
0
 def get(self):
     recipes = Recipe.all()
     recipes.filter('user_id = ', users.get_current_user().user_id())
     tmpl = jinja_env.get_template('list.html')
     self.response.out.write(
         render_template('list.html',
             recipes=recipes,
             base_url=self.request.host_url))
Exemple #2
0
    def post(self):
        recipe = Recipe.from_json(self.request.get('recipe'))
       
        # Make sure nobody tries to write to someone else's stream
        if recipe.user_id != users.get_current_user().user_id():
            self.error(400)
            return

        recipe.put()
Exemple #3
0
 def get(self):
     key = db.Key(self.request.get('id'))
     recipe = Recipe.get(key)
     self.response.out.write(
         render_template('view.html',
             recipe=recipe))