Re: can't save data to the database

2018-11-12 Thread Andréas Kühne
No, I meant like this: def Contact(request): if request.method == 'POST': form = ContactUsForm(request.POST) if form.is_valid(): form.save() context = {'form': form} return redirect('contactus.html') else: form = ContactUsForm()

Re: can't save data to the database

2018-11-12 Thread Andréas Kühne
Just move the return render part from the get request path to always return. That way you will get the form with the correct information when the form isn't valid. Regards, Andréas Den mån 12 nov. 2018 kl 15:20 skrev Tosin Ayoola : > yes the form is valid and the issue is the form doesn't

Re: can't save data to the database

2018-11-12 Thread Andréas Kühne
Hi, First of all - are you sure that the form is valid? You don't show the ContactUs model, but I'm guessing that all fields are required? Are they all filled in? Second - in the contact method you first check if it is a POST and then populate with: form = ContactUsForm(request.POST or None). The

can't save data to the database

2018-11-12 Thread Tosin Ayoola
halo, working on a contact us form to receive information from the user but my issue is the data doesn't get save to the database and i'm not getting any error message can anyone help out below is my view an forms.py -- You received this message because you are subscribed to the Google Groups