<s> from django . shortcuts import render_to_response <EOL> from django . template . loader import render_to_string <EOL> from notifications . models import Notification <EOL> def list ( request ) : <EOL> objects = [ ] <EOL> notifications = Notification . objects . filter ( recipient = request . user ) . order_by ( "<STR_LIT>" ) <EOL> for i in xrange ( <NUM_LIT:10> ) : <EOL> objects . append ( { <EOL> "<STR_LIT>" : render_to_string ( <EOL> "<STR_LIT>" % notifications [ i ] . type . label , { <EOL> "<STR_LIT>" : notifications [ i ] } ) , <EOL> "<STR_LIT:date>" : notifications [ i ] . date <EOL> } ) <EOL> notifications . update ( seen = True ) <EOL> notifications [ <NUM_LIT:10> : ] . delete ( ) <EOL> return render_to_response ( "<STR_LIT>" , <EOL> { "<STR_LIT>" : objects } ) </s>
