##// END OF EJS Templates
Throw error 404 when trying to open invalid page in threads list
neko259 -
r977:6b112efe default
parent child Browse files
Show More
@@ -1,6 +1,8 b''
1 from django.core.files import File
1 from django.core.files import File
2 from django.core.files.temp import NamedTemporaryFile
2 from django.core.files.temp import NamedTemporaryFile
3 from django.core.paginator import EmptyPage
3 from django.db import transaction
4 from django.db import transaction
5 from django.http import Http404
4 from django.shortcuts import render, redirect
6 from django.shortcuts import render, redirect
5 import requests
7 import requests
6
8
@@ -46,7 +48,10 b' class AllThreadsView(PostMixin, BaseBoar'
46 settings.THREADS_PER_PAGE)
48 settings.THREADS_PER_PAGE)
47 paginator.current_page = int(page)
49 paginator.current_page = int(page)
48
50
49 threads = paginator.page(page).object_list
51 try:
52 threads = paginator.page(page).object_list
53 except EmptyPage:
54 raise Http404()
50
55
51 params[PARAMETER_THREADS] = threads
56 params[PARAMETER_THREADS] = threads
52 params[CONTEXT_FORM] = form
57 params[CONTEXT_FORM] = form
General Comments 0
You need to be logged in to leave comments. Login now