Beispiel #1
0
def contact(request, template='main/pages/contact.html'):
    if request.method == "POST":
        
        form = ContactusForm(request.POST)
        if form.is_valid():
            form.save()
            messages.info(request, _("We received your message and will get back to you soon, thanks!"))
            return redirect('home')
    else:
        form = ContactusForm()
    return render(request, template, {'form': form})
Beispiel #2
0
def contactus(request):
	if request.method == 'POST':
        	form = ContactusForm(request.POST)
        # check whether it's valid:
        	if form.is_valid():
            	# process the data in form.cleaned_data as required
            		form.save()
            	# redirect to a new URL:
			messages.info(request, _("We received your message, we will respond shortly. Thank you!"))
		else:
			messages.error(request, _("Your message has not been sent. Please fill in all the fields."))
    	# if a GET (or any other method) we'll create a blank form
    	else:
        	form = ContactusForm()

	return render(request,'index.html',{'form':form})
Beispiel #3
0
def contactus(request):
    if request.method == 'POST':
        form = ContactusForm(request.POST)
        # check whether it's valid:
        if form.is_valid():
            # process the data in form.cleaned_data as required
            form.save()
            # redirect to a new URL:
            messages.info(
                request,
                _("We received your message, we will respond shortly. Thank you!"
                  ))
        else:
            messages.error(
                request,
                _("Your message has not been sent. Please fill in all the fields."
                  ))
# if a GET (or any other method) we'll create a blank form
    else:
        form = ContactusForm()

    return render(request, 'base.html', {'form': form})
Beispiel #4
0
def index(request):
    if request.method == 'POST':
        form = ContactusForm(request.POST)
        # check whether it's valid:
        if form.is_valid():
            # process the data in form.cleaned_data as required
            form.save()
            # redirect to a new URL:
            messages.info(
                request,
                "Մենք ստացանք Ձեր նամակը, շուտով կպատասխանենք։ Շնորհակալություն"
            )
        else:
            messages.error(
                request,
                "Ձեր նամակը դեռ չի ուղարկվել։ Խնդրում ենք լրացնել բոլոր դաշտերը։"
            )
    # if a GET (or any other method) we'll create a blank form
    else:
        form = ContactusForm()

    return render(request, 'main/index.html', {'form': form})