Ejemplo n.º 1
0
def SubmitQuestionHandler(request):
	params = {}
	if request.method=='GET':
		params = request.GET
	elif request.method=='POST':
		params = request.POST
	
	ques = Question(userid=str(params["user"]),question=(params["question"]))
	ques.save()
        
	t = loader.get_template('post-submit.html')
	c = Context({})
	return HttpResponse(t.render(c))
Ejemplo n.º 2
0
def SubmitQuestionHandler(request):
	params = request.POST

	print request.user.id
	print request.user.username
	
	ques = Question(userid=request.user.id, username=request.user.username, question=(params["question"]))
	ques.save()
	if "tags" in params:
		t = params["tags"]
		tags = t.split(',')
		print tags
		for thisTag in tags:
			thisTag = Tag(qid=ques, tag=thisTag)
			thisTag.save()

	t = loader.get_template('post-submit.html')
	c = RequestContext(request)
	return HttpResponse(t.render(c))