Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(5)  |  Call(4)  |  Derive(0)  |  Import(1)

src/q/u/quanda-HEAD/views/__init__.py   quanda(Download)
 
import quanda.models
from quanda.forms import QuestionForm, QuestionTagForm, QuestionListForm, QuestionListOrderForm, QuestionListAddForm, AnswerForm, RepForm, ProfileForm, CommentForm
from quanda.models import Question, QuestionVote, QuestionTag, QuestionList, QuestionListOrder, QuestionView, Answer, AnswerVote, Profile, Comment
from quanda.utils import get_user_rep
def question_read(request, question_id=None, msg=None, context={}):
    question = get_object_or_404(Question, pk=question_id)
 
    # user answers question
    answer_form = AnswerForm(request.user, question)    
    if request.method == "POST" and request.POST.has_key('answer_question'):
        answer_form = AnswerForm(request.user, question, request.POST)
 
    if request.method == 'POST':
        answer_form = AnswerForm(request.user, answer.question, request.POST, edit=True, instance=answer)
        if answer_form.is_valid():
            answer_form.save()
            return HttpResponseRedirect(reverse('quanda_question_read', args=[answer.question.id]))
    else:
        answer_form = AnswerForm(request.user, answer.question, instance=answer)