def get(self, userid): """Get a list of all of a user's hashtags.""" user_tags = Hashtag.get_hashtags_by_user(userid) tags_list = [t[0] for t in user_tags] return {'hashtags': tags_list}
def get_suggestions(): """Get user data for typeahead suggestions.""" userid = session['User'] #### Hashtag Data #### hashtag_data = Hashtag.get_hashtags_by_user(userid) hashtag_list = [h[0] for h in hashtag_data] #### Recipe Data #### recipe_data = Recipe.get_user_recipe_list(userid) recipe_list = [r[1] for r in recipe_data] #### Ingredient Data #### ingredient_data = Ingredient.get_ingredients_by_user(userid) # convert to set then back to list to remove duplicates ingredient_list = list(set([i[0] for i in ingredient_data])) #### Combined Data #### data_list = hashtag_list + recipe_list + ingredient_list return jsonify({"userdata": data_list})