Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing different 'Forms' for different methods
    primarykey
    data
    text
    <p>I hope i can express myself right, here it goes. </p> <p>I have a handler for a html page that has the objective of editing a "chapter". In this page the chapters are listed and you can use a button to add more chapters. So the first time you open the page, the chapters are listed and a button to add more. If you click 'add', it should present you the same page but with a form for the chapter information.</p> <p>My problem is passing the information of what chapters are we editing when we reload the page, because a can't pass the 'tut_key' - the reference to the chapters. </p> <p>editTut.html:</p> <pre><code>{% for chap in chaps %} Title: {{ chap.title}}&lt;br&gt; {% endfor %} {% if not editMode or editMode == 0 %} &lt;form ????????&gt; &lt;input id="tutBtnNext" type="submit" value="Add"&gt; &lt;/form&gt; {% endif %} {% if editMode == 1 %} &lt;form method="post"&gt; &lt;!-- form stuff --&gt; &lt;/form&gt; {% endif %} </code></pre> <p>the class:</p> <pre><code>class EditTut(FuHandler): def get(self): tutID = self.request.get('tut_key') tut = db.Key.from_path('Tutorial', tutID) chaps = db.GqlQuery("SELECT * FROM Chapter " + "WHERE tutorial = :1", tut) self.render('editTut.html', chaps=chaps) def post(self): tutID = self.request.get("tut_key") tutorial = db.Key.from_path('Tutorial', tutID) title = self.request.get("chapTitle") content = self.request.get("content") note = self.request.get("note") chap = Chapter(tutorial=tutorial, title=title, content=content, note=note) chap.put() self.redirect('/editTut?tut_key=%s' % tutID) #should i use something like this? #I tried but i can't find a way to call this function on the html def addChap(self): tutID = self.request.get("tut_key") self.redirect('/editTut?tut_key=%s' % tutID) </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload