示例#1
0
def home(request):
    context_instance = RequestContext(request)
    if request.method == 'GET':
        return render_to_response('index.html')
    elif request.method == 'POST':
        data = request.POST.urlencode()
        comment = data.split('&')[0].split('=')[1]
        author = data.split('&')[1].split('=')[1]
        p1 = Comments(user_id=author, post_id='1', comment=comment)
        p1.save()
        return render_to_response('index.html')
示例#2
0
def home(request):
	context_instance=RequestContext(request)
	if request.method == 'GET':
		return render_to_response('index.html')
	elif request.method == 'POST':
		data = request.POST.urlencode()
		comment = data.split('&')[0].split('=')[1]
		author = data.split('&')[1].split('=')[1]
		p1 = Comments(user_id=author,
			post_id = '1',
			comment = comment)
		p1.save()
		return render_to_response('index.html')
示例#3
0
def home(request):
    # context_instance = RequestContext(request)
    if request.method == 'GET':
        return render_to_response('index.html')
    elif request.method == 'POST':
        queryDict = QueryDict()
        queryDict = request.POST
        a = dict(queryDict.lists())
        comment = str(a.get('text')).split("'")[1].decode('utf-8')
        author = str(a.get('author')).split("'")[1].decode('utf-8')
        print 'comment - ' + comment
        print 'author - ' + author
        p1 = Comments(user_id=author, post_id='1', comment=comment)
        p1.save()
        return render_to_response('index.html')
示例#4
0
def home(request):
    # context_instance = RequestContext(request)
    if request.method == 'GET':
        return render_to_response('index.html')
    elif request.method == 'POST':
        queryDict = QueryDict()
        queryDict = request.POST
        a = dict(queryDict.lists())
        comment = str(a.get('text')).split("'")[1].decode('utf-8')
        author = str(a.get('author')).split("'")[1].decode('utf-8')
        print 'comment - ' + comment
        print 'author - ' + author
        p1 = Comments(user_id=author,
                      post_id='1',
                      comment=comment)
        p1.save()
        return render_to_response('index.html')