greyli / bluelog

Check out the newer version (2024) of this project: https://github.com/greyli/greybook
MIT License
454 stars 662 forks source link

manage_category()的参数? #7

Closed Ecvelnter closed 5 years ago

Ecvelnter commented 5 years ago

bluelog/bluelog/blueprints/admin.py manage_category() 这个函数没定义参数呢?

greyli commented 5 years ago

什么参数?

Ecvelnter commented 5 years ago

你好,初学请教: bluelog/bluelog/blueprints/admin.py里面的manage_category() @admin_bp.route('/category/manage') @login_required def manage_category(): return render_template('admin/manage_category.html') 没有categories,直接调用manage_category.html的话, {% block content %} 就不成立了,所以无论数据库里面有无categorie,执行的都是这个? ` {% else %}

No categories.
`
greyli commented 5 years ago

分类数据,也就是模板里使用的 categories 变量使用模板上下文处理函数注入到模板里了(相关代码),所以这里不需要重复传递。

Ecvelnter commented 5 years ago

哇!谢谢!

greyli commented 5 years ago

不客气。