#NEWLINE# @ decorators . login_required #NEWLINE# def playlist_add( request , form_class = PlaylistAddForm , template_name = 'playlist/playlist_add.html' , extra_context = None ) : #NEWLINE# #INDENT# context = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# form = form_class ( request . POST ) #NEWLINE# form . user = request . user #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# object = form . save ( commit = False ) #NEWLINE# object . creation_user = request . user #NEWLINE# object . save ( ) #NEWLINE# return http . HttpResponseRedirect ( object . get_absolute_url ( ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# form = form_class ( initial = { #NEWLINE# #INDENT# 'tags' : 'work, eat, chill...' , #NEWLINE# 'name' : 'chilling, working, eating ...' , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# if ( ( form . data . get ( 'tags' , False ) == 'work, eat, chill...' ) or ( form . initial . get ( 'tags' , False ) == 'work, eat, chill...' ) ) : #NEWLINE# #INDENT# form [ 'tags' ] . field . widget . attrs [ 'class' ] = 'magic_value' #NEWLINE# #UNINDENT# if ( ( form . data . get ( 'name' , False ) == 'chilling, working, eating ...' ) or ( form . initial . get ( 'name' , False ) == 'chilling, working, eating ...' ) ) : #NEWLINE# #INDENT# form [ 'name' ] . field . widget . attrs [ 'class' ] = 'magic_value' #NEWLINE# #UNINDENT# context [ 'form' ] = form #NEWLINE# context . update ( ( extra_context or { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ) #NEWLINE# return shortcuts . render_to_response ( template_name , context , context_instance = template . RequestContext ( request ) )