<s> from django . shortcuts import render <EOL> from django . http import HttpResponseRedirect <EOL> from django . core . urlresolvers import reverse <EOL> from django . contrib . admin . views . decorators import staff_member_required <EOL> from . utils import ( <EOL> get_blocked_ips , get_blocked_usernames , unblock_ip , unblock_username ) <EOL> @ staff_member_required <EOL> def block_view ( request ) : <EOL> """<STR_LIT>""" <EOL> blocked_ip_list = get_blocked_ips ( ) <EOL> blocked_username_list = get_blocked_usernames ( ) <EOL> context = { '<STR_LIT>' : blocked_ip_list , <EOL> '<STR_LIT>' : blocked_username_list } <EOL> return render ( request , '<STR_LIT>' , context ) <EOL> @ staff_member_required <EOL> def unblock_ip_view ( request , ip_address ) : <EOL> """<STR_LIT>""" <EOL> if request . method == '<STR_LIT:POST>' : <EOL> unblock_ip ( ip_address ) <EOL> return HttpResponseRedirect ( reverse ( "<STR_LIT>" ) ) <EOL> @ staff_member_required <EOL> def unblock_username_view ( request , username ) : <EOL> """<STR_LIT>""" <EOL> if request . method == '<STR_LIT:POST>' : <EOL> unblock_username ( username ) <EOL> return HttpResponseRedirect ( reverse ( "<STR_LIT>" ) ) </s>
