<s> try : <EOL> from functools import wraps <EOL> except ImportError : <EOL> from django . utils . functional import wraps <EOL> from django . utils . translation import ugettext as _ <EOL> from django . contrib . admin . forms import AdminAuthenticationForm <EOL> from django . contrib . auth . views import login <EOL> from django . contrib . auth import REDIRECT_FIELD_NAME <EOL> def staff_member_required ( view_func ) : <EOL> """<STR_LIT>""" <EOL> def _checklogin ( request , * args , ** kwargs ) : <EOL> if request . user . is_active and request . user . is_staff : <EOL> return view_func ( request , * args , ** kwargs ) <EOL> assert hasattr ( request , '<STR_LIT>' ) , "<STR_LIT>" <EOL> defaults = { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : AdminAuthenticationForm , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:title>' : _ ( '<STR_LIT>' ) , <EOL> '<STR_LIT>' : request . get_full_path ( ) , <EOL> REDIRECT_FIELD_NAME : request . get_full_path ( ) , <EOL> } , <EOL> } <EOL> return login ( request , ** defaults ) <EOL> return wraps ( view_func ) ( _checklogin ) </s>
