#NEWLINE# @ login_required #NEWLINE# def update( request , slug ) : #NEWLINE# #INDENT# if request . POST : #NEWLINE# #INDENT# channel = get_object_or_404 ( Channel , slug = slug ) #NEWLINE# get_object_or_404 ( Subscription , user = request . user , channel = channel , status = 'admin' ) #NEWLINE# form = UpdateChannelForm ( request . POST , instance = channel ) #NEWLINE# if form . is_valid ( ) : #NEWLINE# #INDENT# channel = form . save ( ) #NEWLINE# messages . add_message ( request , messages . SUCCESS , _ ( ( 'You Updated %s Channel' % channel ) ) ) #NEWLINE# return HttpResponseRedirect ( channel . get_absolute_url ( ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return render_to_response ( 'channels/create.html' , { #NEWLINE# #INDENT# 'action' : 'update' , #NEWLINE# 'form' : form , #NEWLINE# #UNINDENT# } , context_instance = RequestContext ( request ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# channel = get_object_or_404 ( Channel , slug = slug ) #NEWLINE# get_object_or_404 ( Subscription , user = request . user , channel = channel , status = 'admin' ) #NEWLINE# return render_to_response ( 'channels/create.html' , { #NEWLINE# #INDENT# 'action' : 'update' , #NEWLINE# 'form' : UpdateChannelForm ( instance = channel ) , #NEWLINE# #UNINDENT# } , context_instance = RequestContext ( request ) )