Ejemplo n.º 1
0
def unsubscribe_stream(request):
    response = reply_object()
    form = ManageStreamForm(request.POST, request=request)
    if form.is_valid():
        response = form.unsubscribe()
    else:
        response["code"] = settings.APP_CODE['FORM ERROR']
        response['errors'] = form.errors
    return HttpResponse(simplejson.dumps(response))
Ejemplo n.º 2
0
def delete_stream(request):
    response = reply_object()
    form = ManageStreamForm(request.POST, request=request)
    if form.is_valid():
        response = form.delete_stream()
        streams = Stream.objects.filter(owner=request.user)
        response["page"] = render_to_string("stream/stream_list.html",
                                        {"streams": streams})
        response["code"] = settings.APP_CODE["PAGE LOADED"]
    else:
        response["code"] = settings.APP_CODE["FORM ERROR"]
        response["errors"] = form.errors
    return HttpResponse(simplejson.dumps(response))