I created a form wizard of 6 steps, 
in step sixth, have filefield for uploading docfile1

django docs is poor on this topic, google does not help.


my code working ok, but how handle filefield.

need example, thanks


forms.py

class Step6(forms.Form):

     docfile1 = forms.FileField(required=False)


view.py


   1. class RegInfo(SessionWizardView):
   2.     template_name = 'gest/wizard_form.html'
   3.     file_storage = FileSystemStorage(location=os.path.join(settings.
   MEDIA_ROOT, 'docs'))
   4.  
   5.     def get_context_data(self, form, **kwargs):
   6.         context = super(RegInfo, self).get_context_data(form, **kwargs
   )
   7.        
   8.         if self.steps.current == 'six':
   9.             print 'step 6'
   10.            
   11.         return context
   12.  
   13.     def done(self, form_list, **kwargs):
   14.         dati = self.get_all_cleaned_data()
   15.  
   16.         s = Info()
   17.         s.tec = self.request.user
   18.         s.dataso = dati['dataso']
   19.        
   20.         s.docfile1 = ????????
   21.        
   22.         s.save()
   23.  
   24.         return render_to_response('gest/done.html', {
   25.             'form_data': [form.cleaned_data for form in form_list],
   26.         })
   27.  
   28. 
   

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to