@handle_response_format
@treeio_login_required
def stream_add(request, response_format='html'):
    "New message stream"
    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)
dataset/ETHPy150Open treeio/treeio/treeio/messaging/views.py/stream_add/original