Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第六章6.1.1 (P115)3. Model的__str__方法 #62

Open
5868dubdub opened this issue Jul 13, 2021 · 0 comments
Open

第六章6.1.1 (P115)3. Model的__str__方法 #62

5868dubdub opened this issue Jul 13, 2021 · 0 comments

Comments

@5868dubdub
Copy link

blog的3个model中只有category和tag有name,而post没有name,不能简单套用下面的代码class Category ...... return self.name,否则在添加文章或评论时会报错。(虽然书上在代码前有提示不要简单套用:“类似于这样”)
解决方法:class Category的和class Tag 的不需要改,class Post的改成return self.title

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant