def readblog(request, blog_id): print "In READ Blog",blog_id,Blog # p = get_object_or_404(Blog, pk=blog_id) print "DIR:",dir(Blog) p = Blog.objects(id=blog_id) #print p return render_to_response('dblog/readblog.html', {'blog': p},context_instance=RequestContext(request))
def readblog(request, blog_id): print "In READ Blog", blog_id, Blog # p = get_object_or_404(Blog, pk=blog_id) print "DIR:", dir(Blog) p = Blog.objects(id=blog_id) #print p return render_to_response('dblog/readblog.html', {'blog': p}, context_instance=RequestContext(request))
def postEntry(request): '''Accepts the HTTP POST data of a new blog entry and updates the database accordingly''' b = Blog() b.title = request.POST['title'] b.reply_to = request.POST['reply_to'] b.content = request.POST['content'] b.post_date = datetime.datetime.now() b.save() return HttpResponseRedirect('/blog/%s/' % b.id)
def comment(request, blog_id): """ To view the comments related to Blog """ print "In comment",blog_id #blog = get_object_or_404(Blog, pk=blog_id) blog = Blog.objects(id=blog_id) print "Blog::",blog comments = blog.comments print "COMMENTS:",comments,blog return render_to_response('dblog/comment.html',{'comments': comments,'blog': blog})
def comment(request, blog_id): """ To view the comments related to Blog """ print "In comment", blog_id #blog = get_object_or_404(Blog, pk=blog_id) blog = Blog.objects(id=blog_id) print "Blog::", blog comments = blog.comments print "COMMENTS:", comments, blog return render_to_response('dblog/comment.html', { 'comments': comments, 'blog': blog })