python - django - 'float' object cannot be interpreted as an integer -


when using python 2.7 code working fine. when installed python 3.4 , runserver, typeerror occurs on lines starts "return render_to_response"(3 place).

exception value "'float' object cannot interpreted integer". not sure error caused version difference.

the code writen bellow.

thank you.

def notice(request, page_id = 1):     context = requestcontext(request)   if not request.user.has_perm("board/category1_can_read"):     return httpresponseredirect(request.path)   post_list = post.objects.filter(category=1)[::-1]   cut = len(post_list)/6   if not len(post_list)%6:     cut -= 1   if (cut <= 0) , (1 < page_id):     max_page = 1     raise http404   else:     max_page = cut + 1   = int(page_id) - 1    post_list = post_list[i*6:(i+1)*6] #divide post list pages (6 post per page)    return render_to_response("board/notice.html", {"board_active": "active", "post_list": post_list, "page_id": int(page_id), "max_page": range(max_page)}, context)     def boarda(request, category_id = 2, page_id = 1):    context = requestcontext(request)   if not request.user.has_perm("board/category2_can_read"):     return httpresponseredirect(request.path)   if 0 == int(category_id): #selected post     post_list = post.objects.all()[::-1]   else:     post_list = post.objects.filter(category=int(category_id))[::-1]   cut = len(post_list)/6   if not len(post_list)%6:     cut -= 1   if (cut <= 0) , (1 < page_id):     max_page = 1     raise http404   else:     max_page = cut + 1   = int(page_id) - 1   post_list = post_list[i*6:(i+1)*6]   return render_to_response("board/boarda.html", {"boarda_active": "active", "post_list": post_list, "category_id": int(category_id), "page_id": int(page_id), "max_page": range(max_page)}, context)   def boardb(request, page_id = 1):        context = requestcontext(request)   if not request.user.has_perm("board/category3_can_read"):     return httpresponseredirect(request.path)   post_list = post.objects.filter(category=3)     cut = len(post_list)/6   if not len(post_list)%6:     cut -= 1   if (cut <= 0) , (1 < page_id):     max_page = 1     raise http404   else:     max_page = cut + 1   = int(page_id) - 1   post_list = post_list[i*6:(i+1)*6]   return render_to_response("board/boardb.html", {"boardb_active": "active", "post_list": post_list, "page_id": int(page_id), "max_page": range(max_page)}, context) 


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -