夹层CMS的配方博客文章
mezzanine-recipes的Python项目详细描述
这个插件为你的夹层网站提供了一个“菜谱”博客帖子类型。
功能
- 嵌入用餐图像
- 提供成分表
- 让您的访客为菜谱添加评论和评分
- 常见的材料-配料、时间、类别
- 用于外部应用程序的REST-API
安装
运行pip install mezzanine-recipes(或者,如果您想破解夹层食谱,请克隆它并运行pip install -e path/to/repo)
创建夹层CMS项目
在INSTALLED_APPS上加上"mezzanine_recipes"和"tastypie"。
使用python manage.py migrate mezzanine_recipes迁移数据库
用python manage.py loaddata mezzanine_required.json
安装夹具要启用Recipe Blog和REST API,请将以下代码放到url.py中:
from mezzanine.conf import settings from tastypie.api import Api from mezzanine_recipes.api import * v1_api = Api(api_name='v1') v1_api.register(CategoryResource()) v1_api.register(KeywordResource()) v1_api.register(AssignedKeywordResource()) v1_api.register(PostResource()) v1_api.register(RecipeResource()) v1_api.register(BlogPostResource()) v1_api.register(IngredientResource()) v1_api.register(WorkingHoursResource()) v1_api.register(CookingTimeResource()) v1_api.register(RestPeriodResource()) v1_api.register(CommentResource()) v1_api.register(RatingResource()) urlpatterns = patterns("", ("^api/", include(v1_api.urls)), ("^%s/" % settings.BLOG_SLUG, include("mezzanine_recipes.urls")), ...
如果需要更详细的安装说明,请查看http://www.robertstevens.org/mezzanine-recipes.html
用法
夹层食谱提供博客文章类型“食谱”Recipe blog post类型表示单个配方
在夹层管理员中创建一个菜谱博客(命名为“菜谱”)。
创建模板
配方列表的模板可以在templates/recipe/recipe_list.html找到,配方博客的模板可以在templates/recipe/recipe_detail.html找到。
配方对象位于mezzanine_recipes.models.recipe。它具有以下属性:
- 时段和时间:workinghours,cookingtime,restperiod
- 烹饪信息:配料,份数,难度,类别
- 文本数据:title,summary,content,comments,ratings
待办事项
- 执行一些测试
- 将单个烹饪步骤添加到食谱中