def index(request): if request.user.is_authenticated(): favs = Favs.get_list(request.user.key()) else: favs = None return render_to_response('index/index.html',{ 'categories': Category.get_for_lists(), 'hpinfo': SPage.get_by_key_name('hpinfo'), 'new_recipes': Recipe.all().filter('rec_vis =', VISIBILITY[2]).filter('disabled =', False).order('-created').fetch(10), 'pop_recipes': Recipe.all().filter('rec_vis =', VISIBILITY[2]).filter('disabled =', False).order('-views').fetch(10), 'fav_recipes': favs, })
def items(self): items = [url_for('index/index', _external=True)] for cat in Category.all().fetch(20): items.append(cat.get_url(True)) return items