中间一大波重复的,有办法精简吗?
def index(request): return HttpResponse("hello world") #软件页面 def software(request): soft=SoftWare.objects.all() cOntent= {'soft':soft} return render(request,'soft_index.html',content) #软件内容页面 def software_detail(request,software_id): soft= SoftWare.objects.get(id=str(software_id)) cOntent= {'soft':soft} return render(request,'soft_detail.html',content) #博客首页 def blog(request): post = Article.objects.all() cOntent={'post':post} return render(request,'blog_index.html',content) #博客内容页面 def blog_detail(request,blog_id): post= Article.objects.get(id=str(blog_id)) cOntent= {'post':post} return render(request,'blog_detail.html',content) #脚本首页 def bash(request): bash = Bash.objects.all() cOntent={'bash':bash} return render(request,'bash_index.html',content) #脚本内容页面 def bash_detail(request,blog_id): bash= Article.objects.get(id=str(blog_id)) cOntent= {'bash':bash} return render(request,'bash_detail.html',content) #视频首页 def video(request): post = Video.objects.all() cOntent={'video':video} return render(request,'video_index.html',content) #视频内容页面 def video_detail(request,blog_id): post= Video.objects.get(id=str(blog_id)) cOntent= {'video':video} return render(request,'video_detail.html',content) 