how do i use the save method in multi step form

18 views
Skip to first unread message

Tosin Ayoola

unread,
Nov 9, 2018, 4:48:58 AM11/9/18
to Django users
hallo developers
i Created a multi step form but the issues is that i can't save the data to the database and that the purpose of creating the form, please how can i fix this or can anyone help me?
, below is my views  code

class add_School(SessionWizardView):
    template_name =  'schoolprofile.html'
    file_storage = FileSystemStorage(location=os.path.join(settings.MEDIA_ROOT, 'images', 'videos'))

    def done(self, form_list, form_dict, **kwargs):
        form_data = process_data(form_list)
       
        return render('index.html',  { 'form_data' :form_data})
       
       
def process_data(form_list):
    form_data = [form.cleaned_data for form in form_list]
    data = ['User', 'School', 'school_data']
   
    send_mail(form_data[0]['Schools'],
              form_data[1]['school_data'],
              ['tosina...@gmail.com', ], fail_silently = False)

   

    return form_data

Reply all
Reply to author
Forward
0 new messages