diff options
author | ashwinishinde | 2015-05-08 16:26:10 +0530 |
---|---|---|
committer | ashwinishinde | 2015-05-08 16:26:10 +0530 |
commit | b0351d0df6ae7fef2a461706542410a7e7ecea35 (patch) | |
tree | 39d94076b3156eca40fbf49560b90130005ba08f /website | |
parent | fd3d3d3c33d078cf497ca69937dc1a5402b4326c (diff) | |
download | FOSSEE-Forum-b0351d0df6ae7fef2a461706542410a7e7ecea35.tar.gz FOSSEE-Forum-b0351d0df6ae7fef2a461706542410a7e7ecea35.tar.bz2 FOSSEE-Forum-b0351d0df6ae7fef2a461706542410a7e7ecea35.zip |
Subject:Update notification count
Description:
1) update notification count after visit.
2) remove notification item from list after visted.
Diffstat (limited to 'website')
-rw-r--r-- | website/views.py | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/website/views.py b/website/views.py index de93b7f..516c7d4 100644 --- a/website/views.py +++ b/website/views.py @@ -140,19 +140,19 @@ def question_answer(request,qid): def answer_comment(request): if request.method == 'POST': answer_id = request.POST['answer_id']; - print answer_id answer = Answer.objects.get(pk=answer_id) answers = answer.question.answer_set.all() form = AnswerCommentForm(request.POST) if form.is_valid(): body = request.POST['body'] - print body comment = AnswerComment() comment.uid = request.user.id comment.answer = answer comment.body = body.encode('unicode_escape') + comment.save() - # notifying the answer owner + # notifying the answer owner + if answer.uid != request.user.id: notification = Notification() notification.uid = answer.uid @@ -241,7 +241,7 @@ def new_question(request): if request.method == 'POST': form = NewQuestionForm(request.POST) if form.is_valid(): - print "EEEEEEEEEEEEEEEE" + cleaned_data = form.cleaned_data question = Question() question.user = request.user @@ -251,8 +251,7 @@ def new_question(request): question.body = cleaned_data['body'].encode('unicode_escape') question.views= 1 question.save() - print "question" - print question.id + # Sending email when a new question is asked subject = 'New Forum Question' message = """ @@ -280,21 +279,20 @@ def new_question(request): return HttpResponseRedirect('/') else: - #fix dirty code + category = request.GET.get('category') form = NewQuestionForm(category=category) context['category'] = category context['form'] = form - print form.errors + context.update(csrf(request)) return render(request, 'website/templates/new-question.html', context) # Notification Section @login_required def user_questions(request, user_id): - print "user_id" - print user_id + marker = 0 if 'marker' in request.GET: marker = int(request.GET['marker']) @@ -309,8 +307,7 @@ def user_questions(request, user_id): 'total': total, 'marker': marker } - print "total" - print total + return render(request, 'website/templates/user-questions.html', context) return HttpResponse("go away") |