diff options
author | Prashant S | 2019-11-05 15:57:51 +0530 |
---|---|---|
committer | GitHub | 2019-11-05 15:57:51 +0530 |
commit | ced78ae9698f0c42e018f87f5dc5bef51de85be7 (patch) | |
tree | 9c4d4fa27290d9d718465ed593889f6f8c6a9fc6 | |
parent | 3400306a95e3b3c5b648228bed05cd1276f8b9f7 (diff) | |
parent | 44df4d59795560026b547c323f55e113f097afb2 (diff) | |
download | R_on_Cloud_Web_Interface-ced78ae9698f0c42e018f87f5dc5bef51de85be7.tar.gz R_on_Cloud_Web_Interface-ced78ae9698f0c42e018f87f5dc5bef51de85be7.tar.bz2 R_on_Cloud_Web_Interface-ced78ae9698f0c42e018f87f5dc5bef51de85be7.zip |
Merge pull request #7 from prashantsinalkar/master
fixed issues.
-rw-r--r-- | website/static/website/js/cloud.js | 29 | ||||
-rw-r--r-- | website/static/website/templates/index.html | 2 | ||||
-rw-r--r-- | website/views.py | 19 |
3 files changed, 10 insertions, 40 deletions
diff --git a/website/static/website/js/cloud.js b/website/static/website/js/cloud.js index de5d9f3..a34f359 100644 --- a/website/static/website/js/cloud.js +++ b/website/static/website/js/cloud.js @@ -146,35 +146,6 @@ $(document.body).ready(function() { $("#diff-wrapper").hide(); $("#contributor").hide(); $("#databox-wrapper").hide(); - }else{ - $.ajax({ - url: 'get_subcategories/', - dataType: 'JSON', - type: 'GET', - data: { - maincat_id: $("#main_categories").val(), - }, - success: function(data) { - ajax_loader("clear"); - $("#categories").html( - ''); - $("#categories").html( - ' <option value="">Select Subcategory</option>' - ); - var j = 1; - for (var i = 0; i < - data.length; i++) { - $('#categories').append( - '<option value="' + - data[i].subcategory_id + - '">' + j + ' - ' + - data[i].subcategory + - '</option>' - ); - j++; - } - } - }); } if ($("#categories").val() == 0) { $("#books-wrapper").hide(); diff --git a/website/static/website/templates/index.html b/website/static/website/templates/index.html index 4b24827..fe31f5b 100644 --- a/website/static/website/templates/index.html +++ b/website/static/website/templates/index.html @@ -94,7 +94,7 @@ <div class="container small"> <form class="col-12"> <div id="main-category-wrapper" class="form-row form-group"> - <label class="col-sm-2 col-form-label font-weight-bold">{{ maincat_id }} Main Category :</label> + <label class="col-sm-2 col-form-label font-weight-bold">Main Category :</label> <select id="main_categories" class="form-control-sm col-sm-10"> <option value="0">Select Main Category</option> {% for category in catg %} {% if maincat_id == category.category_id or maincat_id == 0 %} diff --git a/website/views.py b/website/views.py index c09821c..d6646f4 100644 --- a/website/views.py +++ b/website/views.py @@ -298,16 +298,15 @@ def index(request): context['api_url_upload'] = API_URL_UPLOAD template = loader.get_template('index.html') return HttpResponse(template.render(context, request)) - subcateg_all = TextbookCompanionSubCategoryList.objects\ - .using('r').filter(maincategory_id=maincat_id)\ - .order_by('subcategory_id') - categ_all = TextbookCompanionCategoryList.objects.using('r')\ - .filter(~Q(category_id=0)).order_by('maincategory') - ex_views_count = 0 - #if len(list([ex_views_count[0]])) == 0: - # ex_views_count = 0 - #else: - # ex_views_count = ex_views_count[0] + subcateg_all = get_subcategories(maincat_id) + categ_all = catg() + if ex_views_count != None: + if len(list([ex_views_count[0]])) != 0: + ex_views_count = ex_views_count[0] + else: + ex_views_count = 0 + else: + ex_views_count = 0 context = { 'catg': categ_all, 'subcatg': subcateg_all, |