Im working on a CMS for appengine using python, I have a form page much like how wordpress works where you enter a Title, content and other meta data for the page. Lets say this is AddPage
Once the page is saved the data is stored and a link is shown on the article index page. Just like wordpress when you click on posts. What Im trying to do is once a link is clicked on the index page the user is redirected to a page which is exactly like the AddPage but it already has data filled in ready for editing.
How would I do this am I missing something:
class EditPageHandler(webapp2.RequestHandler):
def get(self, articleID):
page_details = db.GqlQuery("SELECT * FROM TitlePage WHERE key_name = '" + articleID + "'" )
pageDetails_list = page_details.fetch(10)
template = jinja_environment.get_template('templates/editcourse.html')
self.response.out.write(template.render({'page_details':pageDetails_list}))
the html template would display something like:
<input id="author" type="text" name="author" maxlength="120" value="{{ page_details.Author }}">
Im not getting any errors and this does not work so something is not right here:
I have also tried outputting it like so:
Still nothing any help please.
I managed to solve this the approach I was using above was all wrong instead what worked was this:
and as for the html I just did:
And it worked 🙂
Thanks to gwynhowell for the suggestion to improve the code I made the changes and many thanks to you Sebastian Kreft for the suggestion that got me moving in the right track.