Hi I'm using Uploadify in one of my django applications. It works fine. But when I use the @user_passes_test
decorator, uploadify is getting a Http 302 error. Only logged in users with a specific permission should be allowed to use the fileupload.
my view looks like this:
@user_passes_test(lambda u: u.has_perm('cylebrations.can_multiupload'))
def myFileHandler(request):
if request.method == 'POST':
for field_name in request.FILES:
image=Image(gallery_id=gallery.id, image=request.FILES[field_name])
image.save()
return HttpResponse("ok", mimetype="text/plain")
return render_to_response('gallery_upload.html', context_instance=RequestContext(request))
when I use something like following in the view instead of the decorator, I also get a 302 error.
if not request.user.has_perm('cylebrations.can_multiupload'):
return HttpResponse("You can't upload.")
It looks like the view doesn't get the userinformation.
Is there any way to pass the neccessary user information through uploadifys postData
setting? How can I use uploadify with django permissions?