Want to edit datatabase. I have tried this, but it doesn’t work.
def post(self, pageName):$
content = self.request.get('content')$
$
p = db.GqlQuery("SELECT * FROM Pages")$
pages = p.run(batch_size = 1000)$
pageExist = False$
$
for page in pages:$
if pageName == page.name:$
page.content = content$
break$
else:$
p = Pages(name = pageName, content = content)$
p.put()$
self.redirect(pageName)$
Need some code help.
When you find
pageNameand change thecontenton the corresponding page, you’ll need to save page before redirecting.And if the intent is to update a page with new
content, I’m not at all sure what you’re trying to accomplish with thatelse:block.I think you’ll be happier doing something like