diff --git a/.env.example b/.env.example index b9a00a7..c73f646 100644 --- a/.env.example +++ b/.env.example @@ -6,4 +6,6 @@ SPOKEN_DB='13thJune' SECRET_KEY='' VIDEO_PATH='' DEBUG=True -TEMPLATE_DEBUG=True \ No newline at end of file +TEMPLATE_DEBUG=True +URL_MONGO_IP='localhost' +URL_MONGO_PORT='27017' \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9ebc923..6aa15a5 100755 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ static/CACHE/* robots.txt # C extensions *.so +media/ # Packages *.egg @@ -43,4 +44,4 @@ nosetests.xml .pydevproject uwsgi-master.pid .env -.vscode \ No newline at end of file +.vscode diff --git a/requirements.txt b/requirements.txt index 08937ec..bcd2b99 100755 --- a/requirements.txt +++ b/requirements.txt @@ -13,5 +13,12 @@ django-extensions==2.1.3 django-filter==2.0.0 django-debug-toolbar==1.4 python-dotenv==0.10.3 +scikit-learn>=0.19.1 +StackAPI==0.1.12 +pymongo==3.10.1 +lxml==4.6.2 +pandas==0.25.3 nltk==3.5 +scipy==1.4.1 sklearn==0.0 +django-mysql==3.10.0 diff --git a/spoken_auth/models.py b/spoken_auth/models.py index f7bed1b..3fc4a7b 100755 --- a/spoken_auth/models.py +++ b/spoken_auth/models.py @@ -82,3 +82,12 @@ class TutorialResources(models.Model): class Meta: db_table = 'creation_tutorialresource' + + +class TutorialCommonContent(models.Model): + id = models.IntegerField(primary_key=True) + tutorial_detail = models.ForeignKey(TutorialDetails, on_delete=models.CASCADE,) + keyword = models.TextField() + + class Meta: + db_table = 'creation_tutorialcommoncontent' diff --git a/static/website/js/custom.js b/static/website/js/custom.js index d99416f..8b96d7b 100755 --- a/static/website/js/custom.js +++ b/static/website/js/custom.js @@ -66,7 +66,7 @@ $(document).ready(function() { } }); - $tutorial.change(function() { + $tutorial.on('input', function() { /* resetting dropdowns */ reset("minute_range", "second_range"); var category = $category.val(); @@ -98,6 +98,35 @@ $(document).ready(function() { }); } }); + + // this is in faq page + $tutorial.change(function() { + $.ajax({ + url: "/ajax-faq-questions/", + type: "POST", + data: { + category: $category.val(), + tutorial: $tutorial.val(), + }, + dataType: "html", + success: function(data) { + $response = $(data); + var similar_count= $response.find("#similar-count").text(); + console.log(similar_count); + $("#similar-link").show(); + $("#modal-body").html(data); + + $.ajax({ + url:"/ajax-fetch-questions/", + type: "POST", + data: { + category: $category.val(), + tutorial: $tutorial.val(), + } + }); + } + }); + }); $title.keyup(function() { var len = $title.val().split(' ').length; @@ -117,7 +146,8 @@ $(document).ready(function() { success: function(data) { $response = $(data); var similar_count= $response.find("#similar-count").text(); - $("#similar-link").show().html(similar_count); + console.log(similar_count); + $("#similar-link").show(); $("#modal-body").html(data); } }); diff --git a/static/website/templates/ajax-similar-questions.html b/static/website/templates/ajax-similar-questions.html index c3890ab..ad81963 100755 --- a/static/website/templates/ajax-similar-questions.html +++ b/static/website/templates/ajax-similar-questions.html @@ -9,13 +9,17 @@ {% endif %}
+ {% for question in questions %} {% endfor %} diff --git a/static/website/templates/ajax_faq_questions.html b/static/website/templates/ajax_faq_questions.html new file mode 100644 index 0000000..07e4adf --- /dev/null +++ b/static/website/templates/ajax_faq_questions.html @@ -0,0 +1,57 @@ +
+
+ {% if questions.count > 0 %} + {% if questions.count == 1 %} + 1 similar question + {% else %} + {{ questions.count }} similar questions + {% endif %} + {% endif %} +
+
+
- + {{ question.title }} + {% for tag in question.tags %} + {{ tag }} + {% endfor %}
+ {% if questions|length == 0 %} +

No similar questions found

+ {% else %} + + + + + + + + {% endif %} + + {% for question in questions %} + + + + + + {% endfor %} +
Accepted
Answer
Author
Details
Question Details
+ {% if question.accepted_answer != "" %} + + {% endif %} + + + +
+ +   {{ question.title }} + +
+ {% for tag in question.tags %} + {{ tag }} + {% endfor %} +
+
+
+ {{ question.views }} + {{ question.score }} + {{ question.answer_count }} +
+
+
+ + \ No newline at end of file diff --git a/static/website/templates/base.html b/static/website/templates/base.html index 0152830..32c7671 100644 --- a/static/website/templates/base.html +++ b/static/website/templates/base.html @@ -17,7 +17,8 @@ {% endcompress %} - + + + +{% endblock %} + +{% block javascript %} + +{% endblock %} diff --git a/static/website/templates/new-question.html b/static/website/templates/new-question.html index c088447..4f36944 100755 --- a/static/website/templates/new-question.html +++ b/static/website/templates/new-question.html @@ -31,6 +31,13 @@

{% render_field form.second_range class+="form-control" disabled="disabled" %}
+
@@ -61,7 +68,7 @@

- - + --> + + +