<s> from django . contrib import messages <EOL> from django . contrib . auth . decorators import login_required <EOL> from django . http import Http404 <EOL> from django . shortcuts import render_to_response <EOL> from django . template import RequestContext <EOL> from testingstate . forms import MoreKeysForm <EOL> @ login_required <EOL> def generate_testing_keys ( request ) : <EOL> if not request . user . is_staff : <EOL> raise Http404 <EOL> new_keys = None <EOL> form = MoreKeysForm ( ) <EOL> if request . method == '<STR_LIT:POST>' : <EOL> form = MoreKeysForm ( request . POST ) <EOL> if form . is_valid ( ) : <EOL> form . save ( ) <EOL> new_keys = form . new_keys <EOL> messages . success ( request , "<STR_LIT>" . format ( len ( new_keys ) , '<STR_LIT>' if len ( new_keys ) == <NUM_LIT:1> else '<STR_LIT:s>' ) ) <EOL> return render_to_response ( '<STR_LIT>' , { <EOL> '<STR_LIT>' : new_keys , <EOL> '<STR_LIT>' : form , <EOL> } , context_instance = RequestContext ( request ) ) </s>
