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
?
非常感谢你。
class EntryDetail(DetailView):
model = Entry
template_name = 'test/blog-detail.html'
def get_success_url(self):
return self.get_object().get_absolute_url()
这是工作。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句