diff options
author | Jayaram Pai | 2013-12-09 12:47:18 +0530 |
---|---|---|
committer | Jayaram Pai | 2013-12-09 12:47:18 +0530 |
commit | 0dd964ec05401809a408ab55d5517d3b2fba3a85 (patch) | |
tree | 805c74ea457c551cea557be39d16fb91d42cea9f /website | |
parent | b596364cf3f871887cce519291b684341cc5c014 (diff) | |
download | FOSSEE-Forum-0dd964ec05401809a408ab55d5517d3b2fba3a85.tar.gz FOSSEE-Forum-0dd964ec05401809a408ab55d5517d3b2fba3a85.tar.bz2 FOSSEE-Forum-0dd964ec05401809a408ab55d5517d3b2fba3a85.zip |
reply edit with no ajax
Diffstat (limited to 'website')
-rw-r--r-- | website/urls.py | 1 | ||||
-rw-r--r-- | website/views.py | 16 |
2 files changed, 17 insertions, 0 deletions
diff --git a/website/urls.py b/website/urls.py index 774acb9..c385ea0 100644 --- a/website/urls.py +++ b/website/urls.py @@ -14,4 +14,5 @@ urlpatterns = patterns('', url(r'^ajax-tutorials/$', 'website.views.ajax_tutorials', name='ajax_tutorials'), url(r'^ajax-duration/$', 'website.views.ajax_duration', name='ajax_duration'), url(r'^ajax-question-update/$', 'website.views.ajax_question_update', name='ajax_question_update'), + url(r'^ajax-similar-questions/$', 'website.views.ajax_similar_questions', name='ajax_similar_questions'), ) diff --git a/website/views.py b/website/views.py index e18a000..538d90e 100644 --- a/website/views.py +++ b/website/views.py @@ -155,3 +155,19 @@ def ajax_question_update(request): question.body = body question.save() return HttpResponse("saved") + +@csrf_exempt +def ajax_similar_questions(request): + if request.method == 'POST': + category = request.POST['category'] + tutorial = request.POST['tutorial'] + minute_range = request.POST['minute_range'] + second_range = request.POST['second_range'] + + # add more filtering when the forum grows + questions = Question.objects.filter(category=category).filter(tutorial=tutorial) + context = { + 'questions': questions + } + return render(request, 'website/templates/ajax-similar-questions.html', context); + |