예제 #1
0
파일: views.py 프로젝트: codepad/Tumblelog
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))
예제 #2
0
파일: views.py 프로젝트: codepad/Tumblelog
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))
예제 #3
0
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)
예제 #4
0
파일: views.py 프로젝트: codepad/Tumblelog
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})
예제 #5
0
파일: views.py 프로젝트: codepad/Tumblelog
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)
예제 #6
0
파일: views.py 프로젝트: codepad/Tumblelog
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
    })