Skip to content
Snippets Groups Projects
Commit 1a902824 authored by Dmitry Shelepnev's avatar Dmitry Shelepnev
Browse files

Fix pagination error (error in calculating num_pages)

parent bb0f2530
Branches
Tags
No related merge requests found
...@@ -27,7 +27,7 @@ class Paginator: ...@@ -27,7 +27,7 @@ class Paginator:
self.d2_last_pos = d2_MAXITEMS*self.page_num - 1; self.d2_last_pos = d2_MAXITEMS*self.page_num - 1;
self.d2_last_pos = self.d2_last_pos if self.d2_last_pos<self.d2_count else (self.d2_count-1 if self.d2_count else 0) self.d2_last_pos = self.d2_last_pos if self.d2_last_pos<self.d2_count else (self.d2_count-1 if self.d2_count else 0)
self.num_pages = self.count//self.MAXITEMS + 1 if self.count%self.MAXITEMS else 0 self.num_pages = self.count//self.MAXITEMS + 1
self.firstpage = self.page_num - self.HALF_PAGES_LINK self.firstpage = self.page_num - self.HALF_PAGES_LINK
self.lastpage = self.page_num + self.HALF_PAGES_LINK self.lastpage = self.page_num + self.HALF_PAGES_LINK
if self.firstpage<1: if self.firstpage<1:
......
...@@ -192,8 +192,6 @@ class opdsScanner: ...@@ -192,8 +192,6 @@ class opdsScanner:
zip_process_error = 1 zip_process_error = 1
self.bad_archives+=zip_process_error self.bad_archives+=zip_process_error
def processfile(self,name,full_path,file,cat,archive=0,file_size=0): def processfile(self,name,full_path,file,cat,archive=0,file_size=0):
(n,e)=os.path.splitext(name) (n,e)=os.path.splitext(name)
if e.lower() in config.SOPDS_BOOK_EXTENSIONS.split(): if e.lower() in config.SOPDS_BOOK_EXTENSIONS.split():
......
...@@ -136,8 +136,6 @@ AUTH_PASSWORD_VALIDATORS = [ ...@@ -136,8 +136,6 @@ AUTH_PASSWORD_VALIDATORS = [
#LANGUAGE_CODE = 'en-US' #LANGUAGE_CODE = 'en-US'
LANGUAGE_CODE = 'ru-RU' LANGUAGE_CODE = 'ru-RU'
3
LOCALE_PATHS = ( LOCALE_PATHS = (
os.path.join(BASE_DIR, 'sopds/locale'), os.path.join(BASE_DIR, 'sopds/locale'),
) )
......
...@@ -364,6 +364,8 @@ def CatalogsView(request): ...@@ -364,6 +364,8 @@ def CatalogsView(request):
breadcrumbs_list.insert(0, (_('Catalogs'),-1)) breadcrumbs_list.insert(0, (_('Catalogs'),-1))
args['breadcrumbs_cat'] = breadcrumbs_list args['breadcrumbs_cat'] = breadcrumbs_list
print(args['paginator'], catalogs_count, books_count, page_num, config.SOPDS_MAXITEMS, HALF_PAGES_LINKS)
return render(request,'sopds_catalogs.html', args) return render(request,'sopds_catalogs.html', args)
@sopds_login(url='web:login') @sopds_login(url='web:login')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment