Beispiel #1
0
def view_datarequests_for_tag(request, tag_name):
    tags = Tagging.objects.filter(tag=tag_name)
    datarequests_page = paginate(_get_datarequests_for_tags(tags), request.GET)

    return render_to_response(
        'tags/view_datarequests.html', 
        {'tags': tags, 'tag_name': tag_name, 'datarequests_page': datarequests_page},
        context_instance=RequestContext(request))
Beispiel #2
0
def view_datarequests_for_category(request, category_id):
    category = get_object_or_404(Category, pk=category_id)
    datarequests_page = paginate(_get_datarequests_for_category(category), request.GET)
    
    return render_to_response(
        'categories/view_datarequests.html', 
        {'category': category, 'datarequests_page': datarequests_page},
        context_instance=RequestContext(request))
Beispiel #3
0
 def testNonIntPageGivesATerminalPage(self):
 	page = paginate(range(20), {'page': 'qwerty'})
 	self.assertTrue(page.number in terminal_pages(page))
Beispiel #4
0
 def testLargePageGivesLastPage(self):
 	page = paginate(range(20), {'page': '1000000000000000'})
 	self.assertEqual(page.number, page.paginator.page_range[-1])
Beispiel #5
0
 def testNegativePageGivesATerminalPage(self):
 	page = paginate(range(20), {'page': '-7'})
 	self.assertTrue(page.number in terminal_pages(page))
Beispiel #6
0
 def testEmptyObjectListIsPageOne(self):
 	self.assertEqual(paginate([], {}).number, 1)
Beispiel #7
0
 def testPageTwo(self):
 	page = paginate(range(20), {'page': '2'}, per_page=5)
 	self.assertEqual(page.number, 2)
Beispiel #8
0
 def testPageOne(self):
 	page = paginate(range(20), {'page': '1'}, per_page=5)
 	self.assertEqual(page.number, 1)
Beispiel #9
0
 def testPageZeroGivesATerminalPage(self):
 	page = paginate(range(20), {})
 	self.assertTrue(page.number in terminal_pages(page))