I’m a little lost with the best way to process a record from a displayed list. I’m allowing users to click on a link which will contain the record id in the querystring in the following way in my template.html:
<a href="/edit_record?id={{company.key.id}}">Edit</a>
I have in my handler:
application = webapp.WSGIApplication([
('/', DisplayMaphandler),
('/companyadd', AddCompanyHandler),
('/validatecompanies', Validationhandler),
('/addcompanycategories', AddCompanyCategoriesHandler),
('/editcompany', EditCompanyHandler),
('/edit_record', EditRecordHandler),
], debug=True)
and I wish to get at the id, however this code is clearly wrong and does not work at all:
class EditRecordHandler(webapp.RequestHandler):
def get(request):
myid = request.GET.get('id', '')
self.response.out.write(myid)
How should I get at the id from this class. Plus I saw some things on urlconf, do I need to use such a thing. I know this class is triggered when clicking on a link but want to find the smartest way of making this work with the RequestHandler rather than a def function. The error I’m getting is:
AttributeError: 'EditRecordHandler' object has no attribute 'GET'
Thanks
Change the
EditRecordHandlergetmethod in something like this: