disruptive
disruptive

Reputation: 5946

google app engine: getting form fields

How do I get access to the form data. I want to do this before is_valid() is carried out. How do I access a field. I seem to be getting a blank address though.

The code looks like:

def post(self):
    data = CompanyForm(data=self.request.POST)
    map_url = ''    
    address = str(data['company_postcode'])

    address = address.replace(' ', '')

whats the best way to do this?

Upvotes: 1

Views: 353

Answers (1)

Gregg
Gregg

Reputation: 3316

According to the Request class documentation, Request does not have a POST instance variable. You can call self.request.get('company_postcode') to obtain the posted value for company_postcode.

For debugging, the raw POST data can be obtained from self.request.body.

Upvotes: 5

Related Questions