def upload_icon_img(request, app_id, context): app_id = long(app_id) app = App.get_by_id(app_id) if app.developer_id != context["developer"].key.id(): # hoge = app.developer_id # fuga = context["developer"].key.id() return HttpResponseRedirect(reverse(index)) view_url = reverse(upload_img) if request.method == 'POST': form = UploadForm(request.POST, request.FILES) if form.is_valid(): params = form.cleaned_data image = AppImage.getEntity(app_id) image.image = params["file"]["img"] image.content_type = params["file"]["content_type"] image.put() context["debug"] = image return HttpResponseRedirect(reverse(index)) upload_url, upload_data = prepare_upload(request, view_url) form = UploadForm() context["form"] = form context["upload_url"] = upload_url context["upload_data"] = upload_data return render_to_response('webfront/upload_form.html', context)
def upload_img(request, context): view_url = reverse(upload_img) if request.method == 'POST': form = UploadForm(request.POST, request.FILES) if form.is_valid(): params = form.cleaned_data image = ProfImage.getEntity(context["developer"].key.id()) image.image = params["file"]["img"] image.content_type = params["file"]["content_type"] image.put() context["debug"] = image return HttpResponseRedirect(reverse(index)) upload_url, upload_data = prepare_upload(request, view_url) form = UploadForm() context["form"] = form context["upload_url"] = upload_url context["upload_data"] = upload_data return render_to_response('webfront/upload_form.html', context)