def post(self):
        user_key = self.check_user_logged_in.key
        title = self.request.get('title')
        cuisine = self.request.get('cuisine')
        difficulty = self.request.get('difficulty')
        cook_time = self.request.get('cook_time')
        prep_time = self.request.get('prep_time')
        ingredients = self.request.get('ingredients')
        directions = self.request.get('directions')
        photo = self.request.POST['image']

        saved_photo = self.save_image(photo, user_key)

        Recipes.add_new_recipe(
            title=title,
            cuisine=cuisine,
            difficulty=difficulty,
            prep_time=prep_time,
            cook_time=cook_time,
            ingredients=ingredients,
            directions=directions,
            user_key=user_key,
            photo_key=saved_photo['blobstore_key'],
            photo_url=saved_photo['serving_url']
        )

        self.redirect('/account')
Beispiel #2
0
    def post(self):
        user_key = self.check_user_logged_in.key
        title = self.request.get('title')
        cuisine = self.request.get('cuisine')
        difficulty = self.request.get('difficulty')
        cook_time = self.request.get('cook_time')
        prep_time = self.request.get('prep_time')
        ingredients = self.request.get('ingredients')
        directions = self.request.get('directions')
        photo = self.request.POST['image']

        saved_photo = self.save_image(photo, user_key)

        Recipes.add_new_recipe(title=title,
                               cuisine=cuisine,
                               difficulty=difficulty,
                               prep_time=prep_time,
                               cook_time=cook_time,
                               ingredients=ingredients,
                               directions=directions,
                               user_key=user_key,
                               photo_key=saved_photo['blobstore_key'],
                               photo_url=saved_photo['serving_url'])

        self.redirect('/account')
Beispiel #3
0
    def get(self):
        user_id = self.check_user_logged_in.key.id()
        recipes = Recipes.get_all_recipes_by_user(user_id)

        tpl_values = {'recipes': recipes}

        self.render('account/home.html', **tpl_values)
    def get(self, recipe_id):
        recipe = Recipes.get_by_id(int(recipe_id))

        template_values = {
            'recipe': recipe
        }

        self.render('recipe-page/recipe-page.html', **template_values)
    def get(self):
        user_id = self.check_user_logged_in.key.id()
        recipes = Recipes.get_all_recipes_by_user(user_id)

        tpl_values = {
            'recipes': recipes
        }

        self.render('account/home.html', **tpl_values)
Beispiel #6
0
    def return_user_recipes(self, user_id):

        recipes = RecipesModel.getAllRecipesByUserId(self, user_id)
        return recipes, 200
    def get(self, recipe_id):
        recipe = Recipes.get_by_id(int(recipe_id))

        template_values = {'recipe': recipe}

        self.render('recipe-page/recipe-page.html', **template_values)