2011-08-16 2 views
0

왜 양식을하지 유효 빈 이미지 필드 ... 데이터베이스에 해당 빈 기록빈 이미지 필드는

@login_required 
def add_photo(request, gallery_id): 
gallery = get_object_or_404(Gallery, pk=gallery_id) 
PhotoFormSet = formset_factory(PhotoUploadForm, extra=1) 
formset = PhotoFormSet() 
if request.method == "POST": 
    formset = PhotoFormSet(request.POST, request.FILES) 
    if formset.is_valid(): 
     for form in formset: 
      if form.is_valid(): 
       data = form.save(commit=False) 
       data.galleries = gallery 
       data.save() 
return render_to_response("add_photo.html", {'formset': formset, 'album_id': gallery_id}, context_instance=RequestContext(request)) 

답변

0

당신은 당신의 형태로 파일에 대한 필드 = 거짓 유효 필요한 설정하지?

양식 정의를 볼 수 있습니까?

+0

문제가 해결됨 form.cleaned_data.get ("image")이 아닌 경우 없음 : –