将应用程序博客添加到我的Django项目

2024-09-30 22:17:39 发布

您现在位置:Python中文网/ 问答频道 /正文

Django = 2.0
我想这个应用程序添加到我的项目-https://github.com/pythonsd/test-driven-django-development/tree/master/myblog

它对我有用,但我不需要评论。
我不知道如何删除这些评论。在HTML中,我知道如何删除它,但是我想从模型和视图中删除注释,我想在我的项目中有干净的代码

https://github.com/pythonsd/test-driven-django-development/blob/master/myblog/blog/models.py-我要删除类Comment(models.Model),对吗?我想是的

https://github.com/pythonsd/test-driven-django-development/blob/master/myblog/blog/views.py-但是如果我的blog-app中没有注释,我需要从文件中删除什么

非常感谢


Tags: 项目djangohttpstestgithubmastercommodels
1条回答
网友
1楼 · 发布于 2024-09-30 22:17:39
class EntryDetail(DetailView):
    model = Entry
    template_name = 'test/blog-detail.html'

    def get_success_url(self):
        return self.get_object().get_absolute_url()

这是工作

相关问题 更多 >