<?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: Tip of the day: Dynamic forms with Django newforms</title>
	<atom:link href="http://guillaume.segu.in/blog/home/116/tip-of-the-day-dynamic-forms-with-django-newforms/feed/" rel="self" type="application/rss+xml" />
	<link>http://guillaume.segu.in/blog/home/116/tip-of-the-day-dynamic-forms-with-django-newforms/</link>
	<description>Stuff that doesn’t matter</description>
	<lastBuildDate>Wed, 08 Sep 2010 05:46:40 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Mini Searches with Answers - Answer My Searches</title>
		<link>http://guillaume.segu.in/blog/home/116/tip-of-the-day-dynamic-forms-with-django-newforms/comment-page-1/#comment-16803</link>
		<dc:creator>Mini Searches with Answers - Answer My Searches</dc:creator>
		<pubDate>Sat, 13 Feb 2010 03:29:50 +0000</pubDate>
		<guid isPermaLink="false">http://guillaume.segu.in/blog/?p=116#comment-16803</guid>
		<description>[...] iXce’s blog » Blog Archive » Tip of the day: Dynamic forms with Django newformsHow to customize your Django forms at instantiation time i.e., control what fields your form has and how they look at run time. [...]</description>
		<content:encoded><![CDATA[<p>[...] iXce’s blog » Blog Archive » Tip of the day: Dynamic forms with Django newformsHow to customize your Django forms at instantiation time i.e., control what fields your form has and how they look at run time. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Adam Smith</title>
		<link>http://guillaume.segu.in/blog/home/116/tip-of-the-day-dynamic-forms-with-django-newforms/comment-page-1/#comment-10355</link>
		<dc:creator>Adam Smith</dc:creator>
		<pubDate>Tue, 16 Jun 2009 07:01:54 +0000</pubDate>
		<guid isPermaLink="false">http://guillaume.segu.in/blog/?p=116#comment-10355</guid>
		<description>Trial of dynamic forms looks pretty good and interesting to me.</description>
		<content:encoded><![CDATA[<p>Trial of dynamic forms looks pretty good and interesting to me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Greg</title>
		<link>http://guillaume.segu.in/blog/home/116/tip-of-the-day-dynamic-forms-with-django-newforms/comment-page-1/#comment-4881</link>
		<dc:creator>Greg</dc:creator>
		<pubDate>Mon, 20 Oct 2008 22:04:03 +0000</pubDate>
		<guid isPermaLink="false">http://guillaume.segu.in/blog/?p=116#comment-4881</guid>
		<description>Thanks, this is exactly what I was looking to do.  I was worried it wouldn&#039;t be possible.  How did you discover this?</description>
		<content:encoded><![CDATA[<p>Thanks, this is exactly what I was looking to do.  I was worried it wouldn&#8217;t be possible.  How did you discover this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: johnP</title>
		<link>http://guillaume.segu.in/blog/home/116/tip-of-the-day-dynamic-forms-with-django-newforms/comment-page-1/#comment-3230</link>
		<dc:creator>johnP</dc:creator>
		<pubDate>Wed, 23 Jul 2008 18:31:21 +0000</pubDate>
		<guid isPermaLink="false">http://guillaume.segu.in/blog/?p=116#comment-3230</guid>
		<description>Awesome.  Thank you.</description>
		<content:encoded><![CDATA[<p>Awesome.  Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arne</title>
		<link>http://guillaume.segu.in/blog/home/116/tip-of-the-day-dynamic-forms-with-django-newforms/comment-page-1/#comment-3098</link>
		<dc:creator>Arne</dc:creator>
		<pubDate>Sun, 13 Jul 2008 14:55:26 +0000</pubDate>
		<guid isPermaLink="false">http://guillaume.segu.in/blog/?p=116#comment-3098</guid>
		<description>@Roderik: have you tried using a ModelForm?</description>
		<content:encoded><![CDATA[<p>@Roderik: have you tried using a ModelForm?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: iXce</title>
		<link>http://guillaume.segu.in/blog/home/116/tip-of-the-day-dynamic-forms-with-django-newforms/comment-page-1/#comment-1623</link>
		<dc:creator>iXce</dc:creator>
		<pubDate>Fri, 11 Apr 2008 09:06:58 +0000</pubDate>
		<guid isPermaLink="false">http://guillaume.segu.in/blog/?p=116#comment-1623</guid>
		<description>Looks pretty good to me :)</description>
		<content:encoded><![CDATA[<p>Looks pretty good to me <img src='http://guillaume.segu.in/blog/wp-includes/images/smilies/smile.png' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roderik</title>
		<link>http://guillaume.segu.in/blog/home/116/tip-of-the-day-dynamic-forms-with-django-newforms/comment-page-1/#comment-1617</link>
		<dc:creator>Roderik</dc:creator>
		<pubDate>Fri, 11 Apr 2008 06:12:39 +0000</pubDate>
		<guid isPermaLink="false">http://guillaume.segu.in/blog/?p=116#comment-1617</guid>
		<description>Hey, that is very handy. I now also use this to initialise the forms initial values:

&lt;pre&gt;
    def __init__(self, referenceModelInstance, *args, **kwargs):
        super(SomeForm, self).__init__(*args, **kwargs)
        self.referenceModelInstance = referenceModelInstance
        for field in self.fields
            self.fields[field].initial = getattr(self.referenceModelInstance,field)
&lt;/pre&gt;

When creating the form I feed it the model for which I want the form to be instantiated. This of course requires the fields to have the same name as the model fields.

Are there any other drawbacks that I am not thinking about with this code?</description>
		<content:encoded><![CDATA[<p>Hey, that is very handy. I now also use this to initialise the forms initial values:</p>
<pre>
    def __init__(self, referenceModelInstance, *args, **kwargs):
        super(SomeForm, self).__init__(*args, **kwargs)
        self.referenceModelInstance = referenceModelInstance
        for field in self.fields
            self.fields[field].initial = getattr(self.referenceModelInstance,field)
</pre>
<p>When creating the form I feed it the model for which I want the form to be instantiated. This of course requires the fields to have the same name as the model fields.</p>
<p>Are there any other drawbacks that I am not thinking about with this code?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Braydon Fuller</title>
		<link>http://guillaume.segu.in/blog/home/116/tip-of-the-day-dynamic-forms-with-django-newforms/comment-page-1/#comment-1435</link>
		<dc:creator>Braydon Fuller</dc:creator>
		<pubDate>Mon, 07 Apr 2008 01:01:04 +0000</pubDate>
		<guid isPermaLink="false">http://guillaume.segu.in/blog/?p=116#comment-1435</guid>
		<description>Cool. I haven&#039;t used tried newforms yet, looks interesting.</description>
		<content:encoded><![CDATA[<p>Cool. I haven&#8217;t used tried newforms yet, looks interesting.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
