Opened 12 years ago

Closed 12 years ago

#19163 closed Bug (needsinfo)

#bug about comment in views

Reported by: googcheng@… Owned by: nobody
Component: Generic views Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

the error case :

def uploadfile(request):
    #print request
    if request.method == 'POST':
        json_data = simplejson.loads(request.raw_post_data)
        data = json_data['data']
        print "aaaa"
    
        

    '''if request.method == 'POST':
        if request.FILES == None:
            return HttpResponseBadRequest('Must have files attached!')
        print "post",request.POST
        try:
	     f = request.FILES.get('file')
             print "request.FILES\n",request.FILES
	except:
	    print "error"
	
        
        
        url,id = handler(request.FILES['file'],request.POST.get('description',''),request.POST.get('tag',[]))  
        # Extend server-side upload handler to return a JSON response
        data = [{'name': f.name, 'url': url, 'delete_url': reverse('idel',args=[id]), 'delete_type': "DELETE"}]
        print data
        response = JSONResponse(data, {}, response_mimetype(request))
        response['Content-Disposition'] = 'inline; filename=files.json'
        return response '''  
    else:
        form = UploadFileForm()
    return render_to_response('index.html', {'form': form},
			    context_instance=RequestContext(request))

the right one:

def uploadfile(request):
    #print request
    if request.method == 'POST':
        json_data = simplejson.loads(request.raw_post_data)
        data = json_data['data']
        print "aaaa"
    else:
        form = UploadFileForm()
    return render_to_response('index.html', {'form': form},
			    context_instance=RequestContext(request))    
        

    '''if request.method == 'POST':
        if request.FILES == None:
            return HttpResponseBadRequest('Must have files attached!')
        print "post",request.POST
        try:
	     f = request.FILES.get('file')
             print "request.FILES\n",request.FILES
	except:
	    print "error"
	
        
        
        url,id = handler(request.FILES['file'],request.POST.get('description',''),request.POST.get('tag',[]))  
        # Extend server-side upload handler to return a JSON response
        data = [{'name': f.name, 'url': url, 'delete_url': reverse('idel',args=[id]), 'delete_type': "DELETE"}]
        print data
        response = JSONResponse(data, {}, response_mimetype(request))
        response['Content-Disposition'] = 'inline; filename=files.json'
        return response '''  
    

django requires coments length ?

Change History (1)

comment:1 by Claude Paroz, 12 years ago

Resolution: needsinfo
Status: newclosed

Sorry, but this bug report lacks enough information. Please try to explain what you think is a bug as clearly as possible.

Note: See TracTickets for help on using tickets.
Back to Top