]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/views/writers.py
Adds custom header and footer, and a preview mechanism.
[osqa.git] / forum / views / writers.py
index 99e93775015f28b84b9902ee2c441d3effd9726a..aace1f6aa269d63fe6bcd5e974aacabf8054a924 100644 (file)
@@ -17,7 +17,7 @@ from forum.actions import AskAction, AnswerAction, ReviseAction, RollbackAction,
 from forum.modules.decorators import decoratable
 from forum.forms import *
 from forum.models import *
-from forum.utils.forms import get_next_url
+from forum.forms import get_next_url
 
 
 def upload(request):#ajax upload file to a question or answer
@@ -67,7 +67,7 @@ def upload(request):#ajax upload file to a question or answer
 @decoratable
 def ask(request):
     if request.POST and "text" in request.POST:
-        form = AskForm(request.POST)
+        form = AskForm(request.POST, user=request.user)
         if form.is_valid():
             if request.user.is_authenticated():
                 ask_action = AskAction(user=request.user, ip=request.META['REMOTE_ADDR']).save(data=form.cleaned_data)
@@ -82,14 +82,12 @@ def ask(request):
                 request.session['temp_node_type'] = 'question'
                 return HttpResponseRedirect(reverse('auth_action_signin', kwargs={'action': 'newquestion'}))
     elif request.method == "POST" and "go" in request.POST:
-        form = AskForm({'title': request.POST['q']})
+        form = AskForm({'title': request.POST['q']}, user=request.user)
     else:
-        form = AskForm()
+        form = AskForm(user=request.user)
 
-    #tags = _get_tags_cache_json()
     return render_to_response('ask.html', {
         'form' : form,
-        #'tags' : tags,
         'email_validation_faq_url':reverse('faq') + '#validate',
         }, context_instance=RequestContext(request))