Hi Amitesh,

In this view:

On 11/11/2019 20.36, 'Amitesh Sahay' via Django users wrote:

def contact(request):
     if request.method =='POST':
         name_r = request.POST.get('name')
         email_r = request.POST.get('email')
         phone_r = request.POST.get('phone')
         comment_r = request.POST.get('comment')

         form = ContactForm(name=name_r, email=email_r, phone=phone_r, 
comment=comment_r)
         if form.is_valid():
             form.save()
             form = ContactForm()
             return HttpResponse('Thank you for your enquiry')
             return redirect(request, 'contact.html')
         else:
             form = ContactForm()
             return render(request, 'contact.html', {'form': form})


Concider what will happen if request.method is *not* POST?

As a hint, if a Python function doesn't return anything explicitly, it will implicitly return None.

Hope that will guide you in the right direction.

I could just solve it for you, but it's better that you figure it out yourself if you want to learn.

Kind regards,

Kasper Laudrup

--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/43c7a649-b008-d0ef-dd2c-64679c270017%40stacktrace.dk.

Reply via email to