<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Simon says</title>
	<atom:link href="http://simonsay.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://simonsay.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Wed, 23 Jan 2008 22:42:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='simonsay.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Simon says</title>
		<link>http://simonsay.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://simonsay.wordpress.com/osd.xml" title="Simon says" />
	<atom:link rel='hub' href='http://simonsay.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Hooks for m2m-fields and inline formsets in Django newforms</title>
		<link>http://simonsay.wordpress.com/2008/01/23/hooks-for-m2m-fields-and-inline-formsets-in-django-newforms/</link>
		<comments>http://simonsay.wordpress.com/2008/01/23/hooks-for-m2m-fields-and-inline-formsets-in-django-newforms/#comments</comments>
		<pubDate>Wed, 23 Jan 2008 14:53:47 +0000</pubDate>
		<dc:creator>simonsay</dc:creator>
				<category><![CDATA[django]]></category>
		<category><![CDATA[newforms]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://simonsay.wordpress.com/2008/01/23/hooks-for-m2m-fields-and-inline-formsets-in-django-newforms/</guid>
		<description><![CDATA[So, it seems many people, like myself, come across a situation where they when saving an instance want to do some action based on related objects. And most likely they soon find out that the related objects haven&#8217;t been updated or saved by the time the save method is called. The Django ORM gives no [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=simonsay.wordpress.com&amp;blog=522921&amp;post=6&amp;subd=simonsay&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So,</p>
<p>it seems many people, like myself, come across a situation where they when saving an instance want to do some action based on related objects. And most likely they soon find out that the related objects haven&#8217;t been updated or saved by the time the save method is called. The Django ORM gives no such guarantee, and I can see why it&#8217;s made that way. What I think could be done is letting the form processing notify you when many-to-many and inline formsets have been processed.</p>
<p><span id="more-6"></span>So I installed the newforms-admin branch and started digging around. The attached <a href="http://simonsay.files.wordpress.com/2008/01/postformset7028.txt" title="Patch (diff)">patch</a> is what I came up with.</p>
<p>I basically customized form_change, form_add in ModelAdmin and formset_add, formset_change in InlineModelAdmin to pass along the methods post_m2m and post_formset if they are defined in the class.<br />
These are then passed on to the form creation and in the end get called when ManyToManyFields have been updated (post_m2m) or when inline objects in a formset has been updated (post_formset).</p>
<p>Most changes, except those to save_instance in newforms/models.py can easily be broken out and made in sub-classes or new functions instead but I decided to share a version where I patched the code directly since that&#8217;s what I started out doing.</p>
<p>Some random code just to show the concept:</p>
<p><pre class="brush: python;">

class PackageOptionInline(admin.TabularInline):
    model = PackageOption
    extra = 2

    def post_m2m(self,obj):
         print &quot;in packageoption form post_m2m&quot;

    def post_formset(self,objs):
         print &quot;in packageoption form post_formset&quot;,objs
         if objs:
              objs[0].packageconfig.create_packages()

class ContactOptions(admin.ModelAdmin):

      def post_m2m(self,obj):
            &quot;&quot;&quot;in form post_m2m
            perhaps update something
            based on contact categories
            or something else..&quot;&quot;&quot;
            obj.dosomething()

</pre>I hope you get the idea. Let me know if you think I&#8217;m missing something.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/simonsay.wordpress.com/6/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/simonsay.wordpress.com/6/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/simonsay.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/simonsay.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/simonsay.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/simonsay.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/simonsay.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/simonsay.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/simonsay.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/simonsay.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/simonsay.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/simonsay.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/simonsay.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/simonsay.wordpress.com/6/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/simonsay.wordpress.com/6/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/simonsay.wordpress.com/6/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=simonsay.wordpress.com&amp;blog=522921&amp;post=6&amp;subd=simonsay&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://simonsay.wordpress.com/2008/01/23/hooks-for-m2m-fields-and-inline-formsets-in-django-newforms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/32b6d2eaff3ae0d3e94ceb572cd63454?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">simonsay</media:title>
		</media:content>
	</item>
		<item>
		<title>PIM:s and efficiency apps</title>
		<link>http://simonsay.wordpress.com/2006/11/05/pims-and-efficiency-apps/</link>
		<comments>http://simonsay.wordpress.com/2006/11/05/pims-and-efficiency-apps/#comments</comments>
		<pubDate>Sun, 05 Nov 2006 03:05:38 +0000</pubDate>
		<dc:creator>simonsay</dc:creator>
				<category><![CDATA[install]]></category>

		<guid isPermaLink="false">http://simonsay.wordpress.com/2006/11/05/pims-and-efficiency-apps/</guid>
		<description><![CDATA[This can be useful Synchronization setup description, Syncronization service iscrybe.com wordpress Also visited 30boxes and bunch of other sites.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=simonsay.wordpress.com&amp;blog=522921&amp;post=5&amp;subd=simonsay&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This can be useful<br />
<a href="http://engtech.wordpress.com/2006/08/11/the-holy-grail-of-synchronization-how-to-synchronize-microsoft-outlook-multiple-locations-google-calendar-gmail-ipod-and-mobile-phone-with-funambol-scheduleworld/">Synchronization setup description</a>, <a href="http://www.scheduleworld.com/">Syncronization service</a></p>
<p>iscrybe.com</p>
<p>wordpress</p>
<p>Also visited 30boxes and bunch of other sites.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/simonsay.wordpress.com/5/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/simonsay.wordpress.com/5/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/simonsay.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/simonsay.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/simonsay.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/simonsay.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/simonsay.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/simonsay.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/simonsay.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/simonsay.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/simonsay.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/simonsay.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/simonsay.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/simonsay.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/simonsay.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/simonsay.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=simonsay.wordpress.com&amp;blog=522921&amp;post=5&amp;subd=simonsay&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://simonsay.wordpress.com/2006/11/05/pims-and-efficiency-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/32b6d2eaff3ae0d3e94ceb572cd63454?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">simonsay</media:title>
		</media:content>
	</item>
		<item>
		<title>Python links</title>
		<link>http://simonsay.wordpress.com/2006/11/05/python-links/</link>
		<comments>http://simonsay.wordpress.com/2006/11/05/python-links/#comments</comments>
		<pubDate>Sun, 05 Nov 2006 02:54:14 +0000</pubDate>
		<dc:creator>simonsay</dc:creator>
				<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://simonsay.wordpress.com/2006/11/05/python-links/</guid>
		<description><![CDATA[http://online.effbot.org/ http://www.squidoo.com/pythonology<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=simonsay.wordpress.com&amp;blog=522921&amp;post=4&amp;subd=simonsay&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>http://online.effbot.org/</p>
<p>http://www.squidoo.com/pythonology</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/simonsay.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/simonsay.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/simonsay.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/simonsay.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/simonsay.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/simonsay.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/simonsay.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/simonsay.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/simonsay.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/simonsay.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/simonsay.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/simonsay.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/simonsay.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/simonsay.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/simonsay.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/simonsay.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=simonsay.wordpress.com&amp;blog=522921&amp;post=4&amp;subd=simonsay&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://simonsay.wordpress.com/2006/11/05/python-links/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/32b6d2eaff3ae0d3e94ceb572cd63454?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">simonsay</media:title>
		</media:content>
	</item>
		<item>
		<title>Making Last.fm run in Ubuntu Linux</title>
		<link>http://simonsay.wordpress.com/2006/11/05/making-lastfm-run-in-ubuntu-linux/</link>
		<comments>http://simonsay.wordpress.com/2006/11/05/making-lastfm-run-in-ubuntu-linux/#comments</comments>
		<pubDate>Sun, 05 Nov 2006 02:51:56 +0000</pubDate>
		<dc:creator>simonsay</dc:creator>
				<category><![CDATA[install]]></category>
		<category><![CDATA[last.fm]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[music]]></category>

		<guid isPermaLink="false">http://simonsay.wordpress.com/2006/11/05/making-lastfm-run-in-ubuntu-linux/</guid>
		<description><![CDATA[Download http://static.last.fm/player/LastfmLinux-1.0.5.tar.bz2 Unpack the file and copy the Last.fm-1.0.5 directory (as root) to /usr/local/lib. Create /usr/local/bin/lastfm: #! /bin/sh /usr/local/lib/Last.fm-1.0.5/player $1 # end chmod 755 /usr/local/bin/lastfm gconftool-2 --type string --set /desktop/gnome/url-handlers/lastfm/command 'lastfm "%s"' gconftool-2 --type bool --set /desktop/gnome/url-handlers/lastfm/needs_terminal false gconftool-2 --type bool --set /desktop/gnome/url-handlers/lastfm/enabled true Might need to install libxinerama1 if not already there.. Sources: http://www.last.fm/group/Debian+Linux/forum/8592/_/62015 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=simonsay.wordpress.com&amp;blog=522921&amp;post=3&amp;subd=simonsay&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Download http://static.last.fm/player/LastfmLinux-1.0.5.tar.bz2<br />
Unpack the file and copy the Last.fm-1.0.5 directory (as root) to /usr/local/lib. Create /usr/local/bin/lastfm:</p>
<p><code>#! /bin/sh<br />
/usr/local/lib/Last.fm-1.0.5/player $1<br />
# end</code></p>
<p>chmod 755 /usr/local/bin/lastfm</p>
<p><code>gconftool-2 --type string --set /desktop/gnome/url-handlers/lastfm/command 'lastfm "%s"'<br />
gconftool-2 --type bool --set /desktop/gnome/url-handlers/lastfm/needs_terminal false<br />
gconftool-2 --type bool --set /desktop/gnome/url-handlers/lastfm/enabled true<br />
</code><br />
Might need to install libxinerama1 if not already there..</p>
<p>Sources:<br />
http://www.last.fm/group/Debian+Linux/forum/8592/_/62015<br />
and another one containing the url-handling stuff &#8211; link lost though</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/simonsay.wordpress.com/3/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/simonsay.wordpress.com/3/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/simonsay.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/simonsay.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/simonsay.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/simonsay.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/simonsay.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/simonsay.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/simonsay.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/simonsay.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/simonsay.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/simonsay.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/simonsay.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/simonsay.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/simonsay.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/simonsay.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=simonsay.wordpress.com&amp;blog=522921&amp;post=3&amp;subd=simonsay&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://simonsay.wordpress.com/2006/11/05/making-lastfm-run-in-ubuntu-linux/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/32b6d2eaff3ae0d3e94ceb572cd63454?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">simonsay</media:title>
		</media:content>
	</item>
		<item>
		<title>Hello world!</title>
		<link>http://simonsay.wordpress.com/2006/11/05/hello-world/</link>
		<comments>http://simonsay.wordpress.com/2006/11/05/hello-world/#comments</comments>
		<pubDate>Sun, 05 Nov 2006 02:37:43 +0000</pubDate>
		<dc:creator>simonsay</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Welcome to WordPress.com. This is your first post. Edit or delete it and start blogging!<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=simonsay.wordpress.com&amp;blog=522921&amp;post=1&amp;subd=simonsay&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Welcome to <a href="http://wordpress.com/">WordPress.com</a>. This is your first post. Edit or delete it and start blogging!</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/simonsay.wordpress.com/1/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/simonsay.wordpress.com/1/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/simonsay.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/simonsay.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/simonsay.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/simonsay.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/simonsay.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/simonsay.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/simonsay.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/simonsay.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/simonsay.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/simonsay.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/simonsay.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/simonsay.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/simonsay.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/simonsay.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=simonsay.wordpress.com&amp;blog=522921&amp;post=1&amp;subd=simonsay&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://simonsay.wordpress.com/2006/11/05/hello-world/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/32b6d2eaff3ae0d3e94ceb572cd63454?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">simonsay</media:title>
		</media:content>
	</item>
	</channel>
</rss>
