<s> from django . shortcuts import render <EOL> def handler403 ( request ) : <EOL> return render ( request , '<STR_LIT>' , status = <NUM_LIT> ) <EOL> def handler404 ( request ) : <EOL> return render ( request , '<STR_LIT>' , status = <NUM_LIT> ) <EOL> def handler500 ( request ) : <EOL> return render ( request , '<STR_LIT>' , status = <NUM_LIT> ) <EOL> def sort_queryset ( queryset , request , allowed_sorts , default = None ) : <EOL> """<STR_LIT>""" <EOL> sort = request . GET . get ( '<STR_LIT>' , None ) <EOL> if sort in allowed_sorts : <EOL> direction = request . GET . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> sort = ( '<STR_LIT:->' if direction == '<STR_LIT>' else '<STR_LIT>' ) + sort <EOL> queryset = queryset . order_by ( sort ) <EOL> elif default : <EOL> queryset = queryset . order_by ( default ) <EOL> return queryset </s>
