Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
added documentation to functions
Browse files Browse the repository at this point in the history
  • Loading branch information
auyer committed Feb 23, 2017
1 parent e830493 commit 739eff1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion ifbAMPdb/blog/views.py
Original file line number Diff line number Diff line change
@@ -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})
4 changes: 2 additions & 2 deletions ifbAMPdb/searchEngine/views.py
Original file line number Diff line number Diff line change
@@ -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})
Expand Down

0 comments on commit 739eff1

Please sign in to comment.