diff options
author | ankitjavalkar | 2015-09-07 18:03:49 +0530 |
---|---|---|
committer | ankitjavalkar | 2015-09-09 17:45:20 +0530 |
commit | ae10d36297797ffc53275eabe3acfa0cb4bf3b11 (patch) | |
tree | 4c474e8148fb983e30601a606572d0f9c188e3fa | |
parent | e7e4a526e555e5a5dbe27fdc2ecfb85b537387ba (diff) | |
download | online_test-ae10d36297797ffc53275eabe3acfa0cb4bf3b11.tar.gz online_test-ae10d36297797ffc53275eabe3acfa0cb4bf3b11.tar.bz2 online_test-ae10d36297797ffc53275eabe3acfa0cb4bf3b11.zip |
Change app name, related paths in views and readme
-rw-r--r-- | README.md | 28 | ||||
-rw-r--r-- | testapp/templates/demo_urls.py | 2 | ||||
-rw-r--r-- | testapp/yaksh_app/static/yaksh_app/js/question_filter.js | 47 | ||||
-rw-r--r-- | testapp/yaksh_app/templates/yaksh_app/ajax_question_filter.html | 15 | ||||
-rw-r--r-- | testapp/yaksh_app/templates/yaksh_app/design_questionpaper.html | 2 | ||||
-rw-r--r-- | testapp/yaksh_app/templates/yaksh_app/manual_questionpaper.html | 3 | ||||
-rw-r--r-- | testapp/yaksh_app/templates/yaksh_app/question.html | 2 | ||||
-rw-r--r-- | testapp/yaksh_app/views.py | 14 |
8 files changed, 87 insertions, 26 deletions
@@ -1,4 +1,4 @@ -Vimarsh +Yaksh ======== [![Build Status](https://travis-ci.org/FOSSEE/online_test.svg?branch=master)](https://travis-ci.org/FOSSEE/online_test) @@ -28,13 +28,13 @@ Quick Start #### Installation -1. Install the vimarsh app +1. Install the yaksh_app - pip install vimarsh + pip install yaksh_app 1. In the terminal run - vimarsh create_demo [-p PATH] project_name + yaksh create_demo [-p PATH] project_name - ```project_name``` is the desired name of the django project - PATH is an optional argument to specify where the django project will be installed - If PATH is not provided, the project is created in the current directory @@ -48,11 +48,11 @@ Quick Start 1. Run: - vimarsh run_demo + yaksh run_demo 1. In a new terminal run: - sudo vimarsh run_code_server + sudo yaksh run_code_server 1. Open your browser and open the URL ```http://localhost:8000/exam``` @@ -74,18 +74,18 @@ Production Deployment #### Configure MySql server - 1. Create a database named ``online_test`` by following the steps below + 1. Create a database named ``yaksh`` by following the steps below $> mysql -u root -p - mysql> create database online_test + mysql> create database yaksh - 1. Add a user named ```online_test_user``` and give access to it on the database ```online_test``` by following the steps below + 1. Add a user named ```yaksh_user``` and give access to it on the database ```yaksh``` by following the steps below - 1. mysql> grant usage on online_test.* to online_test_user@localhost identified by 'mysecretpassword'; + 1. mysql> grant usage on yaksh.* to yaksh_user@localhost identified by 'mysecretpassword'; - 1. mysql> grant all privileges on online_test.* to online_test_user@localhost; + 1. mysql> grant all privileges on yaksh.* to yaksh_user@localhost; - 1. Create a file named `local.py` in folder `testapp` and insert `DATABASE_PASSWORD = 'mysecretpassword'` and `DATABASE_USER = 'online_test_user'` + 1. Create a file named `local.py` in folder `testapp` and insert `DATABASE_PASSWORD = 'mysecretpassword'` and `DATABASE_USER = 'yaksh_user'` To deploy this app follow the steps below: @@ -104,7 +104,7 @@ To deploy this app follow the steps below: 1. First run the python server provided. This ensures that the code is executed in a safe environment. Do this like so: - $ sudo python testapp/exam/code_server.py + $ sudo python testapp/yaksh_app/code_server.py Put this in the background once it has started since this will not return back the prompt. It is important that the server be running @@ -177,7 +177,7 @@ To install this app follow the steps below: 1. First run the python server provided. This ensures that the code is executed in a safe environment. Do this like so: - $ sudo python testapp/code_server.py + $ sudo python testapp/yaksh_app/code_server.py Put this in the background once it has started since this will not return back the prompt. It is important that the server be running diff --git a/testapp/templates/demo_urls.py b/testapp/templates/demo_urls.py index 275b281..4308eba 100644 --- a/testapp/templates/demo_urls.py +++ b/testapp/templates/demo_urls.py @@ -9,5 +9,5 @@ urlpatterns = patterns('', # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), - url(r'^exam/', include('testapp.exam.urls')), + url(r'^exam/', include('testapp.yaksh_app.urls')), ) diff --git a/testapp/yaksh_app/static/yaksh_app/js/question_filter.js b/testapp/yaksh_app/static/yaksh_app/js/question_filter.js new file mode 100644 index 0000000..065b06b --- /dev/null +++ b/testapp/yaksh_app/static/yaksh_app/js/question_filter.js @@ -0,0 +1,47 @@ +$(document).ready(function(){ + $question_type = $("#id_question_type"); + $marks = $("#id_marks"); + $language = $("#id_language"); + + function question_filter() { + $.ajax({ + url: "/exam/ajax/questions/filter/", + type: "POST", + data: { + question_type: $question_type.val(), + marks: $marks.val(), + language: $language.val() + }, + dataType: "html", + success: function(output) { + var questions = $(output).filter("#questions").html(); + $("#filtered-questions").html(questions); + } + }); + } + + $question_type.change(function() { + question_filter() + }); + + $language.change(function() { + question_filter() + }); + + $marks.change(function() { + question_filter() + }); + + $("#checkall").live("click", function(){ + if($(this).attr("checked")) { + $("#filtered-questions input:checkbox").each(function(index, element) { + $(this).attr('checked', true); + }); + } + else { + $("#filtered-questions input:checkbox").each(function(index, element) { + $(this).attr('checked', false); + }); + } + }); +});
\ No newline at end of file diff --git a/testapp/yaksh_app/templates/yaksh_app/ajax_question_filter.html b/testapp/yaksh_app/templates/yaksh_app/ajax_question_filter.html new file mode 100644 index 0000000..11bf660 --- /dev/null +++ b/testapp/yaksh_app/templates/yaksh_app/ajax_question_filter.html @@ -0,0 +1,15 @@ +<div id="questions"> + {% if questions %} + <h5 class="highlight"><input type="checkbox" id="checkall" class="ignore"> Select All </h5> + {% endif %} + <ul class="inputs-list"> + + {% for question in questions %} + <li> + <label> + <input type="checkbox" name="question" data-qid="{{question.id}}"> <a href="{{URL_ROOT}}/exam/manage/addquestion/{{ question.id }}">{{ question }}</a><br> + </label> + </li> + {% endfor %} + </ul> +</div> diff --git a/testapp/yaksh_app/templates/yaksh_app/design_questionpaper.html b/testapp/yaksh_app/templates/yaksh_app/design_questionpaper.html index 4e24e09..f999cb1 100644 --- a/testapp/yaksh_app/templates/yaksh_app/design_questionpaper.html +++ b/testapp/yaksh_app/templates/yaksh_app/design_questionpaper.html @@ -15,7 +15,7 @@ select </style> {% endblock %} {% block script %} -<script src="/static/exam/js/jquery-1.4.2.min.js" type="text/javascript"></script> +<script src="{{ URL_ROOT }}/static/yaksh_app/js/jquery-1.4.2.min.js" type="text/javascript"></script> <script src="{{ URL_ROOT }}/static/yaksh_app/js/bootstrap-tabs.js"></script> <script src="{{ URL_ROOT }}/static/yaksh_app/js/add_questionpaper.js"></script> diff --git a/testapp/yaksh_app/templates/yaksh_app/manual_questionpaper.html b/testapp/yaksh_app/templates/yaksh_app/manual_questionpaper.html index 66c83ed..9e2a082 100644 --- a/testapp/yaksh_app/templates/yaksh_app/manual_questionpaper.html +++ b/testapp/yaksh_app/templates/yaksh_app/manual_questionpaper.html @@ -14,8 +14,7 @@ select </style> {% endblock %} {% block script %} -<script src="/static/exam/js/jquery-1.4.2.min.js" type="text/javascript"></script> - +<script src="{{ URL_ROOT }}/static/yaksh_app/js/jquery-1.4.2.min.js" type="text/javascript"></script> <script src="{{ URL_ROOT }}/static/yaksh_app/js/add_questionpaper.js"></script> {% endblock %} diff --git a/testapp/yaksh_app/templates/yaksh_app/question.html b/testapp/yaksh_app/templates/yaksh_app/question.html index 8b43fff..594693c 100644 --- a/testapp/yaksh_app/templates/yaksh_app/question.html +++ b/testapp/yaksh_app/templates/yaksh_app/question.html @@ -10,7 +10,7 @@ {% endblock %} {% block script %} -<script src="/static/yaksh_app/js/jquery-1.4.2.min.js" type="text/javascript"></script> +<script src="{{ URL_ROOT }}/static/yaksh_app/js/jquery-1.4.2.min.js" type="text/javascript"></script> <script src="{{ URL_ROOT }}/static/yaksh_app/js/question.js"></script> <script src="{{ URL_ROOT }}/static/yaksh_app/js/bootstrap-modal.js"></script> diff --git a/testapp/yaksh_app/views.py b/testapp/yaksh_app/views.py index c7b97d1..e6aabc4 100644 --- a/testapp/yaksh_app/views.py +++ b/testapp/yaksh_app/views.py @@ -162,7 +162,7 @@ def quizlist_user(request): 'unexpired_quizzes': unexpired_quizzes } - return my_render_to_response("exam/quizzes_user.html", context) + return my_render_to_response("yaksh_app/quizzes_user.html", context) def intro(request, questionpaper_id): @@ -218,7 +218,7 @@ def intro(request, questionpaper_id): 'disable_quiz_time': quiz_disable_time, 'quiz_expired': quiz_expired } - return my_render_to_response('exam/intro.html', context, + return my_render_to_response('yaksh_app/intro.html', context, context_instance=ci) else: return my_redirect("/exam/quizzes/") @@ -231,7 +231,7 @@ def intro(request, questionpaper_id): 'disable_quiz_time': quiz_disable_time, 'quiz_expired': quiz_expired } - return my_render_to_response('exam/intro.html', context, + return my_render_to_response('yaksh_app/intro.html', context, context_instance=ci) @@ -1302,7 +1302,7 @@ def ajax_questions_filter(request): questions = list(Question.objects.filter(**filter_dict)) - return my_render_to_response('exam/ajax_question_filter.html', + return my_render_to_response('yaksh_app/ajax_question_filter.html', {'questions': questions}) @@ -1324,7 +1324,7 @@ def show_all_questions(request): 'questions': questions, 'form': form } - return my_render_to_response('exam/showquestions.html', context, + return my_render_to_response('yaksh_app/showquestions.html', context, context_instance=ci) else: for i in data: @@ -1336,7 +1336,7 @@ def show_all_questions(request): 'questions': questions, 'form': form } - return my_render_to_response('exam/showquestions.html', context, + return my_render_to_response('yaksh_app/showquestions.html', context, context_instance=ci) elif request.method == 'POST' and request.POST.get('edit') == 'edit': data = request.POST.getlist('question') @@ -1381,7 +1381,7 @@ def show_all_questions(request): 'questions': questions, 'form': form } - return my_render_to_response('exam/showquestions.html', context, + return my_render_to_response('yaksh_app/showquestions.html', context, context_instance=ci) |