diff options
author | prashantsinalkar | 2019-11-05 15:54:48 +0530 |
---|---|---|
committer | prashantsinalkar | 2019-11-05 15:54:48 +0530 |
commit | 44df4d59795560026b547c323f55e113f097afb2 (patch) | |
tree | 9c4d4fa27290d9d718465ed593889f6f8c6a9fc6 | |
parent | aff4d07a39801d33e55a057aefbbb17dedb867ab (diff) | |
download | R_on_Cloud_Web_Interface-44df4d59795560026b547c323f55e113f097afb2.tar.gz R_on_Cloud_Web_Interface-44df4d59795560026b547c323f55e113f097afb2.tar.bz2 R_on_Cloud_Web_Interface-44df4d59795560026b547c323f55e113f097afb2.zip |
fixed count issue
-rw-r--r-- | website/views.py | 19 |
1 files changed, 9 insertions, 10 deletions
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, |