From 739eff1c1a1ad7d8be79f4210237fb424c3c9768 Mon Sep 17 00:00:00 2001 From: rafael Date: Thu, 23 Feb 2017 12:30:16 -0300 Subject: [PATCH] added documentation to functions --- ifbAMPdb/blog/views.py | 4 +++- ifbAMPdb/searchEngine/views.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/ifbAMPdb/blog/views.py b/ifbAMPdb/blog/views.py index 02994e1..8de2c97 100644 --- a/ifbAMPdb/blog/views.py +++ b/ifbAMPdb/blog/views.py @@ -1,16 +1,18 @@ from django.shortcuts import render, get_object_or_404 from blog.models import Post -# Create your views here. +#returns a dictionary with a list of the last 2 Blog Posts def homeBlog(): pst = Post.objects.order_by('-published_date')[:2] return ({'posts': pst}) +#loads the blog page with posts ordered by date ( most recent first) def blog(request): posts = Post.objects.order_by('-published_date') return render(request, 'blog/blog.html', {'posts':posts}) +#renders the Blog Post page def blogPost(request, pk): post = get_object_or_404(Post, pk=pk) return render(request, 'blog/blogPost.html', {'post':post}) diff --git a/ifbAMPdb/searchEngine/views.py b/ifbAMPdb/searchEngine/views.py index 73f8277..5f42937 100644 --- a/ifbAMPdb/searchEngine/views.py +++ b/ifbAMPdb/searchEngine/views.py @@ -1,12 +1,12 @@ from django.shortcuts import render, get_object_or_404, render_to_response from searchEngine.models import peptide -# Create your views here. - +# Returns data in a dictionary with a list of 2 Peptides def homeData(): pep = peptide.objects.order_by()[:2] return {'peptides': pep} +#Renders the detail page for a known peptide def detail(request,pk): pep = get_object_or_404(peptide, pdb_id = pk) return render(request,'searchEngine/detail.html', {'peptide' : pep})