|
给老板做网站,这中间一大段有办法精简吗?
- 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)
复制代码 |
|