def show_post(request): """ Create a view for showing the latest 6 post from the blog data is fetched from the model using fetchAllPosts() method """ queryset = Post.fetchAllPosts() if queryset: msg = "All blog posts" context = {'posts': queryset, 'message': msg, } # Create HTTP response , pass data from one view to another else: msg = "Empty blog...add new posts!" context = {'posts': '', 'message': msg} return render_to_response('index.html', context, context_instance=RequestContext(request))
def show_post(request): """ Create a view for showing the latest 6 post from the blog data is fetched from the model using fetchAllPosts() method """ queryset = Post.fetchAllPosts() ss_start = session_start_date(request) if queryset: msg = "All blog posts" context = {'posts': queryset, 'message': msg, 'sessionStartTime' : ss_start, 'sessionStat' : get_sessions(), } # Create HTTP response , pass data from one view to another else: msg = "Empty blog...add new posts!" context = {'posts': '', 'message': msg} res = render_to_response('../../Pythonidae/templates/index.html', context, context_instance=RequestContext(request)) return res