<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Google App Engine and dynamic Django Forms</title>
	<atom:link href="http://www.sapethemape.com/2009/01/google-app-engine-django-forms/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sapethemape.com/2009/01/google-app-engine-django-forms/</link>
	<description>Mapes don&#039;t throw poop.</description>
	<lastBuildDate>Sat, 31 Jul 2010 17:29:57 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
	<item>
		<title>By: Sape</title>
		<link>http://www.sapethemape.com/2009/01/google-app-engine-django-forms/comment-page-1/#comment-30</link>
		<dc:creator>Sape</dc:creator>
		<pubDate>Fri, 30 Jan 2009 22:18:29 +0000</pubDate>
		<guid isPermaLink="false">http://www.sapethemape.com/?p=80#comment-30</guid>
		<description>&lt;p&gt;No, in Python the for loop is more like a foeach loop. So in the case above,&lt;/p&gt;

&lt;p&gt;&lt;code&gt;
for i in self.request.get_all(&#039;quantity&#039;): 
&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;the &lt;strong&gt;i&lt;/strong&gt; will be the values of the quantity input, not 0,1,2... # of quantities. That is why I added the &lt;strong&gt;n&lt;/strong&gt; so I could reference the elements of the &lt;strong&gt;postedNames&lt;/strong&gt; and &lt;strong&gt;postedQuantities&lt;/strong&gt; lists. Perhaps I should of made a while loop:&lt;/p&gt;

&lt;p&gt;&lt;p&gt;
&lt;pre&gt;
n = 0
while n &lt; len(postedQuantities):
     groc = GroceryForm(data={&#039;quantity&#039;:postedQuantities[n],&#039;name&#039;:postedNames[n]})&lt;br /&gt;
     allIngredientsValid = allIngredientsValid and groc.is_valid()
     groceriesList.append(groc)
     n += 1
&lt;/pre&gt;
&lt;/p&gt;
&lt;p&gt;Since the form will have the same number of quantities and names that go with the quantities the loop will hit all the values. Hope that helps. Thanks for the feedback!&lt;/p&gt;&lt;/p&gt;

&lt;p&gt;Python For Loop Reference:
http://ibiblio.org/g2swap/byteofpython/read/for-loop.html&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>No, in Python the for loop is more like a foeach loop. So in the case above,</p>
<p><code><br />
for i in self.request.get_all('quantity'):<br />
</code></p>
<p>the <strong>i</strong> will be the values of the quantity input, not 0,1,2&#8230; # of quantities. That is why I added the <strong>n</strong> so I could reference the elements of the <strong>postedNames</strong> and <strong>postedQuantities</strong> lists. Perhaps I should of made a while loop:</p>
</p>
<p><pre>
n = 0
while n &lt; len(postedQuantities):
     groc = GroceryForm(data={'quantity':postedQuantities[n],'name':postedNames[n]})
     allIngredientsValid = allIngredientsValid and groc.is_valid()
     groceriesList.append(groc)
     n += 1
</pre>
</p>
<p>Since the form will have the same number of quantities and names that go with the quantities the loop will hit all the values. Hope that helps. Thanks for the feedback!</p>
<p>Python For Loop Reference:<br />
<a href="http://ibiblio.org/g2swap/byteofpython/read/for-loop.html" rel="nofollow">http://ibiblio.org/g2swap/byteofpython/read/for-loop.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John</title>
		<link>http://www.sapethemape.com/2009/01/google-app-engine-django-forms/comment-page-1/#comment-29</link>
		<dc:creator>John</dc:creator>
		<pubDate>Thu, 29 Jan 2009 05:02:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.sapethemape.com/?p=80#comment-29</guid>
		<description>&lt;p&gt;Don&#039;t you mean this?
&lt;code&gt;
        for n in self.request.get_all(&#039;quantity&#039;):
&lt;/code&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Don&#8217;t you mean this?<br />
<code><br />
        for n in self.request.get_all('quantity'):<br />
</code></p>
]]></content:encoded>
	</item>
</channel>
</rss>
