@handle_response_format
@treeio_login_required
def stream_add(request, response_format='html'):
 user = request.user.profile
 if request.POST:
  if ('cancel' not in request.POST):
   stream = MessageStream()
   form = MessageStreamForm(user, request.POST, instance=stream)
   if form.is_valid():
    stream = form.save()
    stream.set_user_from_request(request)
    return HttpResponseRedirect(reverse('messaging'))
  else:
   return HttpResponseRedirect(reverse('messaging'))
 else:
  form = MessageStreamForm(user)
 context = _get_default_context(request)
 context.update({'form': form})
 return render_to_response('messaging/stream_add', context, context_instance=RequestContext(request), response_format=response_format)

@ handle_response_format @ treeio_login_required def stream_add ( request , response_format = 'html' ) : user = request . user . profile if request . POST : if ( 'cancel' not in request . POST ) : stream = MessageStream ( ) form = MessageStreamForm ( user , request . POST , instance = stream ) if form . is_valid ( ) : stream = form . save ( ) stream . set_user_from_request ( request ) return HttpResponseRedirect ( reverse ( 'messaging' ) ) else : return HttpResponseRedirect ( reverse ( 'messaging' ) ) else : form = MessageStreamForm ( user ) context = _get_default_context ( request ) context . update ( { 'form' : form } ) return render_to_response ( 'messaging/stream_add' , context , context_instance = RequestContext ( request ) , response_format = response_format )
new message stream .