Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7835119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:29:23+00:00 2026-06-02T13:29:23+00:00

Not sure whats going on. I added a contact form to a website(it works)

  • 0

Not sure whats going on. I added a contact form to a website(it works) but when i tied it to my base.html i noticed that my menu isnt working (#global variable) on this particular site (html looks like there is no menu at all, just div surrounding it). It buggs only in contact_form.html which contains my form. Any idea why would this happen?

forms.py

class ContactForm(forms.Form):
    name = forms.CharField(required=False, label='Your name')
    email = forms.EmailField(label='E-mail address')
    subject = forms.CharField(label='Subject')
    phone = forms.CharField(required=False, label='Phone number')
    message = forms.CharField(label='Your message')

views.py

def contact(request):
    if request.method == 'POST':
        form = ContactForm(request.POST)
        if form.is_valid():
            cd = form.cleaned_data
            message = cd['message']
        # construct the message body from the form's cleaned data
        body = """\
        from: %s
        name: %s
        phone: %s
        message: %s""" % (cd['email'], cd['name'], cd['phone'], cd['message'])
        send_mail(
                  cd['subject'], #subject is here
                  body, #here is the message
                  settings.DEFAULT_FROM_EMAIL, # from
                  [settings.DEFAULT_FROM_EMAIL] # to
        )
        return HttpResponseRedirect('/contact/thanks/')
    else:
        form = ContactForm()
    csrf_form = {'form': form}
    csrf_form.update(csrf(request))
    return render_to_response('contact_form.html',csrf_form)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T13:29:24+00:00Added an answer on June 2, 2026 at 1:29 pm

    aganders3 was right.

    i think i found my solution here: https://docs.djangoproject.com/en/dev/ref/templates/api/

    fixed the code above so it looks like:

    return render_to_response('contact_form.html',
                              csrf_form,
                              context_instance=RequestContext(request)
                              )
    

    Everything works as it supposed to now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm not sure what's going on, but on my own laptop, everything works okay.
Not sure whats going on here, or what could be the integer in this
Not sure what's going on here, but my iPhone apps nav bar shows back
I'm not sure what's going on here but here's a section I'm having problems
I'm not too sure what's going on here but I'm trying to echo a
I'm not quite sure what's going on, but several issues are occurring on our
This seems pretty straight forward but I'm not sure what is going wrong. I'm
Not sure what's going on here... My controller methods looks like this: [HttpGet] public
CSS is not my strong suit, and I am not sure what's going on
Not too sure what's going on here as this doesn't seem like standard practise

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.