Esempio n. 1
0
def DeleteSpecificRow(request):
	memo_id = request.GET['memo_id']
	current_page = request.GET['current_page']
	print '#### DeleteSpecificRow ######'
	print 'memo_id', memo_id
	print 'current_page', current_page
	
	p = DjangoBoard.objects.get(id=memo_id)
	p.delete()
	
	# Display Page    

	totalCnt = DjangoBoard.objects.all().count()  
	pagingHelperIns = pagingHelper();
	
	totalPageList = pagingHelperIns.getTotalPageList( totalCnt, rowsPerPage)
	print 'totalPages', totalPageList
	
	if( int(current_page) in totalPageList):
		print 'current_page No Change'
		current_page=current_page
	else:
		current_page= int(current_page)-1
		print 'current_page--'            
			
	url = '/listSpecificPageWork?current_page=' + str(current_page)
	return HttpResponseRedirect(url)    
Esempio n. 2
0
def home(request):   
	boardList = DjangoBoard.objects.order_by('-id')[0:10]        
	current_page =1
	totalCnt = DjangoBoard.objects.all().count() 
	
	pagingHelperIns = pagingHelper();
	totalPageList = pagingHelperIns.getTotalPageList( totalCnt, rowsPerPage)
	print 'totalPageList', totalPageList
	
	return render_to_response('listSpecificPage.html', {'boardList': boardList, 'totalCnt': totalCnt, 
														'current_page':current_page ,'totalPageList':totalPageList} ) 
Esempio n. 3
0
def listSpecificPageWork(request):    
	current_page = request.GET['current_page']
	totalCnt = DjangoBoard.objects.all().count()                  
	
	print 'current_page=', current_page
	
	boardList = DjangoBoard.objects.raw('SELECT Z.* FROM(SELECT X.*, ceil((rownum/%s) as page FROM ( SELECT ID,SUBJECT,NAME, CREATED_DATE, MAIL,MEMO,HITS FROM sb_DJANGOBOARD ORDER BY ID DESC ) X ) Z WHERE page = %s', [rowsPerPage, current_page])
		
	print  'boardList=',boardList, 'count()=', totalCnt
	
	pagingHelperIns = pagingHelper();
	
	totalPageList = pagingHelperIns.getTotalPageList( totalCnt, rowsPerPage)
		
	print 'totalPageList', totalPageList
	
	return render_to_response('listSpecificPage.html', {'boardList': boardList, 'totalCnt': totalCnt, 
														'current_page':int(current_page) ,'totalPageList':totalPageList} )
Esempio n. 4
0
def listSearchedSpecificPageWork(request):
	searchStr = request.GET['searchStr']
	pageForView = request.GET['pageForView']
	print 'listSearchedSpecificPageWork:searchStr', searchStr, 'pageForView=', pageForView
		
	#boardList = DjangoBoard.objects.filter(subject__contains=searchStr)
	#print  'boardList=',boardList
	
	totalCnt = DjangoBoard.objects.filter(subject__contains=searchStr).count()
	print  'totalCnt=',totalCnt
	
	pagingHelperIns = pagingHelper();
	totalPageList = pagingHelperIns.getTotalPageList( totalCnt, rowsPerPage)
	
	 
	boardList = DjangoBoard.objects.raw("""SELECT Z.* FROM ( SELECT X.*, ceil(rownum/ %s) as page \
		FROM ( SELECT ID,SUBJECT,NAME, CREATED_DATE, MAIL,MEMO,HITS FROM SB_DJANGOBOARD \
		WHERE SUBJECT LIKE '%%'||%s||'%%' ORDER BY ID DESC) X ) Z WHERE page = %s""", [rowsPerPage, searchStr, pageForView])
		
	print'boardList=',boardList
	
	return render_to_response('listSearchedSpecificPage.html', {'boardList': boardList, 'totalCnt': totalCnt, 
														'pageForView':int(pageForView) ,'searchStr':searchStr, 'totalPageList':totalPageList} )