##// END OF EJS Templates
Moved 404 page to class-based views
neko259 -
r555:89908dc2 1.7-dev
parent child Browse files
Show More
@@ -0,0 +1,12 b''
1 from django.shortcuts import render
2
3 from boards.views.base import BaseBoardView
4
5 class NotFoundView(BaseBoardView):
6 '''
7 Page 404 (not found)
8 '''
9
10 def get(self, request):
11 context = self.get_context_data(request=request)
12 return render(request, 'boards/404.html', context)
@@ -27,11 +27,6 b" BAN_REASON_SPAM = 'Autoban: spam bot'"
27 DEFAULT_PAGE = 1
27 DEFAULT_PAGE = 1
28
28
29
29
30 def page_404(request):
31 """Show page 404 (not found error)"""
32
33 context = _init_default_context(request)
34 return render(request, 'boards/404.html', context)
35
30
36
31
37 @transaction.atomic
32 @transaction.atomic
@@ -20,4 +20,4 b" urlpatterns = patterns('',"
20 url(r'^', include('boards.urls')),
20 url(r'^', include('boards.urls')),
21 ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
21 ) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
22
22
23 handler404 = 'boards.views.page_404'
23 handler404 = 'boards.views.not_found.NotFoundView.as_view()'
General Comments 0
You need to be logged in to leave comments. Login now