Commit 14bfa849 authored by Jean Michel Rouly's avatar Jean Michel Rouly
Browse files

Submit Question view parses input.

parent 6fa7f9d1
from website.models import Question, Comment, Reply, User
from website.models import Question, Comment, Reply
from website.forms import QuestionForm
from django.conf import settings
from django.shortcuts import render_to_response, get_object_or_404
from django.shortcuts import render
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.template import RequestContext
from django.http import HttpResponseRedirect
import requests
......@@ -14,8 +18,20 @@ def instructions(request):
@login_required
def submit_question(request):
if request.method == 'POST':
form = QuestionForm(request.POST)
if form.is_valid():
question = form.save(commit=False)
question.user = User.objects.get(id=request.user.id)
question.save()
return HttpResponseRedirect('/')
else:
form = QuestionForm()
return render_to_response('submit_question.html', {
'form' : form,
},
RequestContext(request),
)
@login_required
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment