def index(request): """Cookbook homepage. """ variables = { 'recipe_categories': group_by_category(Recipe.objects.all()), } return render_to_response('cookbook/index.html', variables)
def ingredient_groups(self): """Return a list of ``(category, [ingredients])`` for this recipe. ``category`` is ``None`` for any ingredients without a defined category. """ return group_by_category(self.ingredients.all())