阅读背景:

多对一的Flask SqlAlchemy渲染

来源:互联网 

I'm trying to create categories for my posts. End result should be a user when trying to post, they choose a category, the post goes under that category so it can be indexed there. So for example they'd go on example.com/category/Flask and they'd find all the posts that have the Flask category. I added to the post model a category_id and category and then I created a Category model with an id and a name. Then created a form so I can add categories to the category table so users can start choosing categories for their posts. What has worked for me is that I can create categories, choose them when posting, and when I look at the database tables I can see that those posts have categories assigned to them. So what I want to do now is to create a view for /category/, and I have no idea how to do that. I'm trying to create categories for my posts. E




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: