syntax error:
msg = "keyword can't be an expression"
offset = None
print_file_and_line = None
text = 'data = data(name and mood=self.request.POST)\n'
I'm posting much of the code here as even though my Datastore has a "Visitor" Entity with name, mood, date properties (the index.yaml file is working apparently), form data is not being submitted to Datastore as evident in Console query:
SELECT name FROM Visitor
^ SyntaxError: invalid syntax
The last section of the following is me guessing what to do from modified Google tutorial. I know it's wrong but hope you see what I'm trying to do:
class Visitor(db.Model):
name = db.StringProperty(required=1)
mood = db.StringProperty(choices=["Good","Bad","Fair"]) # this is Radio button
date = db.DateTimeProperty(auto_now_add=True)
class MainPage(webapp.RequestHandler):
def get(self):
self.response.out.write("""<html><body>
<form action="/" method="post">
<p>First Name: <input type="text" name="name"/></p> # text
<p><input type="radio" name="mood" value="good">Good</p> # radio button v
<p><input type="radio" name="mood" value="bad">Bad</p>
<p><input type="radio" name="mood" value="fair">Fair</p>
<p><input type="submit"value="Process"></p>
</form></body></html>""")
def post(self):
name = self.request.get("name")
mood = self.request.get("mood")
data = data(name and mood=self.request.POST) # < < ^ ^ PROBLEM(S)
if data.is_valid():
Visitor = data.save(commit=False)
Visitor.put()
thanks in advance for help to attain desired goal.