##// END OF EJS Templates
Rewriting views to class-based
Rewriting views to class-based

File last commit:

r542:8b7899f5 1.7-dev
r542:8b7899f5 1.7-dev
Show More
banned.py
16 lines | 518 B | text/x-python | PythonLexer
neko259
Rewriting views to class-based
r542 from django.shortcuts import get_object_or_404, render
from boards import utils
from boards.models import Ban
from boards.views.base import BaseBoardView
class BannedView(BaseBoardView):
def get(self, request):
"""Show the page that notifies that user is banned"""
context = self.get_context_data(request)
ban = get_object_or_404(Ban, ip=utils.get_client_ip(request))
context['ban_reason'] = ban.reason
return render(request, 'boards/staticpages/banned.html', context)