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 6207543
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:38:56+00:00 2026-05-24T05:38:56+00:00

Ok more on forms. I have finally got my form to validate, post and

  • 0

Ok more on forms. I have finally got my form to validate, post and redirect to page it needs to. Now my issue is when I return to the page with the form I get this error:

Caught AttributeError while rendering: ‘WSGIRequest’ object has no attribute ‘get’

Seems the only way to restore it to work is to delete the forms.py replacing what was not working before. Add what is working and I can get it to work ONCE. Any ideas what can cause this issue?

FORMS:

class LeadSubmissionForm(forms.ModelForm):
    """
    A simple default form for messaging.
    """
    class Meta:
         model = Lead
        fields = ( 
            'parent_or_student', 'attending_school', 'how_much', 'year_of_study', 'zip_code', 'email_address', 'graduate_year', 'graduate_month', 'email_loan_results'
        )

VIEWS:

@render_to("lender/main_views/home.html")
def home(request):
    if request.method == 'POST':
        form = LeadSubmissionForm(request.POST)
        if form.is_valid():
            form.save()
            return HttpResponseRedirect(reverse("search_results"))
    else:
        form = LeadSubmissionForm(request)

    testimonials = Testimonial.objects.filter(published=True)[:3]
    return {'lead_submission_form':form,
        'testimonials': testimonials,}

MODELS:

class Lead(TitleAndSlugModel):
    """
    A lead submitted through the site (i.e. someone that has at-least submitted the search form
    """

    PARENT_OR_STUDENT = get_namedtuple_choices('PARENT_OR_STUDENT', (
        (0, 'PARENT', 'Parent'),
        (1, 'STUDENT', 'Student'),
    ))
    YEARS_OF_STUDY = get_namedtuple_choices('YEARS_OF_STUDY', (
        (0, 'ONE', '1'),
        (1, 'TWO', '2'),
        (2, 'THREE', '3'),
        (3, 'FOUR', '4'),
    ))

    parent_or_student = models.PositiveIntegerField(choices=PARENT_OR_STUDENT.get_choices(), default=0)
    attending_school = models.ForeignKey(School)
    how_much = models.DecimalField(max_digits=10, decimal_places=2)
    year_of_study = models.PositiveIntegerField(choices=YEARS_OF_STUDY.get_choices(), default=0)
    zip_code = models.CharField(max_length=8)
    email_address = models.EmailField(max_length=255)
    graduate_year = models.IntegerField()
    graduate_month = models.IntegerField()
    email_loan_results = models.BooleanField(default=False)

    def __unicode__(self):
        return "%s - %s" % (self.email_address, self.attending_school)

Again any help is great help. Thank you!!

  • 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-05-24T05:38:57+00:00Added an answer on May 24, 2026 at 5:38 am

    You don’t need to pass in the request when instantiating the LeadSubmissionForm when the request.method == ‘GET’.

    To save a few lines of code, you can also do:

    @render_to("lender/main_views/home.html")
    def home(request):
        form = LeadSubmissionForm(request.POST or None)
        if request.method == 'POST':
            if form.is_valid():
                form.save()
                return HttpResponseRedirect(reverse("search_results"))
        testimonials = Testimonial.objects.filter(published=True)[:3]
        return {'lead_submission_form':form, 'testimonials': testimonials}
    

    Hope that helps you out.

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

Sidebar

Related Questions

I have a two or more forms on my page in a row. I'm
Right now, I have more than 25 vertices that form a model. I want
Is it legal to have an HTML form with more than one hidden control
I have several strings in the rough form: [some text] [some number] [some more
I have a MS Access database with few tables and a form. When more
Suppose you're building an HTML form and you want to have 2 or more
In Windows Forms programming, I have this general problem. When the page is loading
I'm trying to build a better/more powerful form class for Django. It's working well,
I'm using jsf 1.2. When a particular jsp has more than one form with
To give more information I am using the modular form here: http://jqueryui.com/demos/dialog/#modal-form `b(e.target).zIndex` is

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.