<?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/"
	>

<channel>
	<title>blog.timc3.com &#187; Websites</title>
	<atom:link href="http://blog.timc3.com/category/computing/websites/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.timc3.com</link>
	<description>providing news and views since 2003</description>
	<lastBuildDate>Thu, 02 Feb 2012 19:59:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<link rel="http://api.friendfeed.com/2008/03#sup" xmlns="http://www.w3.org/2005/Atom" type="application/json" href="http://friendfeed.com/api/public-sup.json#9e509d204d"/>		<item>
		<title>Javascript MVC frameworks with MVC server frameworks</title>
		<link>http://blog.timc3.com/2012/01/21/javascript-mvc-frameworks-with-mvc-server-frameworks/</link>
		<comments>http://blog.timc3.com/2012/01/21/javascript-mvc-frameworks-with-mvc-server-frameworks/#comments</comments>
		<pubDate>Sat, 21 Jan 2012 09:24:51 +0000</pubDate>
		<dc:creator>timc3</dc:creator>
				<category><![CDATA[Websites]]></category>
		<category><![CDATA[backbone.js]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://blog.timc3.com/?p=918</guid>
		<description><![CDATA[Really interesting article about Javascript MVC frameworks at CodeBrief. Personally and for work I am totally into backbone.js. It is changing the way that I work with Javascript in my web applications for the better by bringing greater structure and organisation to my code and having a common methodology in the way that I approach [...]]]></description>
			<content:encoded><![CDATA[<p>Really interesting article about Javascript MVC frameworks at <a href="http://codebrief.com/2012/01/the-top-10-javascript-mvc-frameworks-reviewed/?utm_source=javascriptweekly&#038;utm_medium=email" title="CodeBrief">CodeBrief</a>. </p>
<p>Personally and for work I am totally into backbone.js. It is changing the way that I work with Javascript in my web applications for the better by bringing greater structure and organisation to my code and having a common methodology in the way that I approach server-browser communications.</p>
<p>The only problem that I have is that having a MVC stack in the browser is fine, but then we have the same on the server side with Rails (ok not exactly MVC), Django, Node.js or what have you. We end up with MVCMVC or rather MCVCMV, and this is of course a pattern that causes code duplication if we are not careful.</p>
<p>I might look into creating backbone.js models from Django at some point, but I am not sure that this is the correct route. Obviously the way that GWT and <a href="http://pyjs.org">PyJamas</a> work becomes more compelling. Well for <a target="_self" href="mailto:tim@nospamplease.timc3.com">me</a> GWT is not that compelling as I don&#8217;t really want to have to work on frontend in Java, I don&#8217;t think there is the control that one needs over the presentation and I can&#8217;t stand Eclipse/NetBeans/xxxx IDE&#8217;s as they are slow and cumbersome.</p>
<p>Regarding the Codebrief article ember.js came out on top, and I can see the negatives of backbone.js in its somewhat boilerplate approach though I think this can be minimised somewhat.</p>
<p>Personally I think my goals going forward for Javascript is:</p>
<ol>
<li>Find a decent testing enviroment that I am happy with</li>
<li>Loading of modules should be optional, and I need to work to convert my existing application to load intelligently our backbone.js models and views</li>
<li>Greater reuse or automatic generation of code</li>
</ol>
<p>I am intending to write about all of this on this blog in the near future as I come up with more conclusions.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.timc3.com/2012/01/21/javascript-mvc-frameworks-with-mvc-server-frameworks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django Select Multiple filter.</title>
		<link>http://blog.timc3.com/2010/11/02/django-select-multiple-filter/</link>
		<comments>http://blog.timc3.com/2010/11/02/django-select-multiple-filter/#comments</comments>
		<pubDate>Tue, 02 Nov 2010 16:33:28 +0000</pubDate>
		<dc:creator>timc3</dc:creator>
				<category><![CDATA[django]]></category>
		<category><![CDATA[Websites]]></category>

		<guid isPermaLink="false">http://blog.timc3.com/?p=829</guid>
		<description><![CDATA[Django has a really nice select multiple field, for choosing multiple items at once with a Javascript chooser.. It is really handy to use when there is a large number of items that have to be chosen from in a select. I am using with JQuery. To do this, grab SelectFilter2.js from the django-admin media [...]]]></description>
			<content:encoded><![CDATA[<p>Django has a really nice select multiple field, for choosing multiple items at once with a Javascript chooser..</p>
<p><a href="http://blog.timc3.com/wp-content/uploads/2010/11/django-admin-after.png"><img src="http://blog.timc3.com/wp-content/uploads/2010/11/django-admin-after-300x142.png" alt="" title="django-select-multiple" width="300" height="142" class="alignright size-medium wp-image-830" /></a></p>
<p>It is really handy to use when there is a large number of items that have to be chosen from in a select. I am using with JQuery.</p>
<p>To do this, grab SelectFilter2.js from the django-admin media folder, or get it from Django&#8217;s GitHub repository. Then to initialize it you can put the following into your code:</p>
<div class="codecolorer-container javascript vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; $.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;select[multiple]&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span> <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #006600; font-style: italic;">// &quot;Locations&quot; can be any label you want</span><br />
&nbsp; &nbsp; SelectFilter.<span style="color: #660066;">init</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">id</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Locations&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;/media/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp;<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>This will use the SelectFilter on all select multiples and give it a label of locations.</p>
<p>For reference the functions are:</p>
<div class="codecolorer-container javascript vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;<span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>field_id<span style="color: #339933;">,</span> field_name<span style="color: #339933;">,</span> is_stacked<span style="color: #339933;">,</span> admin_media_prefix<span style="color: #009900;">&#41;</span></div></div>
<p>So you could use:</p>
<div class="codecolorer-container javascript vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp;SelectFilter.<span style="color: #660066;">init</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#MySelect&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;Test&quot;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;{{ MEDIA_URL}}img/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></div>
<p>Then all that needs is styling the select multiple.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.timc3.com/2010/11/02/django-select-multiple-filter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Orbited + Django dev daemon</title>
		<link>http://blog.timc3.com/2010/08/21/orbited-django/</link>
		<comments>http://blog.timc3.com/2010/08/21/orbited-django/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 14:11:36 +0000</pubDate>
		<dc:creator>timc3</dc:creator>
				<category><![CDATA[Websites]]></category>

		<guid isPermaLink="false">http://blog.timc3.com/?p=813</guid>
		<description><![CDATA[Today I got my Django project working with Orbited. By creating a twisted proxy for Orbited and Django I am able to serve a development environment for both Django and Orbited plus the builtin MorbidQ message queue. I am going to be using this to give live notifications of events that are happening on the [...]]]></description>
			<content:encoded><![CDATA[<p>Today I got my Django project working with Orbited.</p>
<p>By creating a twisted proxy for Orbited and Django I am able to serve a development environment for both Django and Orbited plus the builtin MorbidQ message queue.</p>
<p>I am going to be using this to give live notifications of events that are happening on the system in realtime, and so it should be able to handle quite a large load. To do this I will use another queue in production, but I have found it needed to sort out the development environment first of course.</p>
<p>This daemon I have put up at <a href="http://github.com/timc3/django-dev-orbited">GitHub</a> .</p>
<p>It even serves the static files. Much thanks goes to the HotDot project for seeing how alot of this was done, but I have taken out the authentication and other bits to make it cleaner for general use.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.timc3.com/2010/08/21/orbited-django/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Realtime web &#8211; Orbited vs Tornado</title>
		<link>http://blog.timc3.com/2010/08/16/realtime-web-orbited-vs-tornado/</link>
		<comments>http://blog.timc3.com/2010/08/16/realtime-web-orbited-vs-tornado/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 20:18:31 +0000</pubDate>
		<dc:creator>timc3</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Websites]]></category>

		<guid isPermaLink="false">http://blog.timc3.com/?p=807</guid>
		<description><![CDATA[My latest task and one that I have been researching and playing with for some time is to integrate real time feedback in to our web application. The main goal is to be able to provide real time feedback of jobs and updates to users without Ajax style polling. This is a simple requirement to [...]]]></description>
			<content:encoded><![CDATA[<p>My latest task and one that I have been researching and playing with for some time is to integrate real time feedback in to our web application. The main goal is to be able to provide real time feedback of jobs and updates to users without Ajax style polling.</p>
<p>This is a simple requirement to write, but one that had many deeper issues. Firstly it needs to be able to handle many users concurrently and secondly it should do so without blocking execution of code. Our application framework was not designed for this and this is no problem, it has been designed to do certain thing well and other I am really not going to force upon it.</p>
<p>The main application framework will handle the standard page requests, user authentication and the rest of the standard stack, so I have been looking at technologies to complement its capabilities. This has led <a target="_self" href="mailto:tim@nospamplease.timc3.com">me</a> to look at Comet applications and very fast non-block frameworks.</p>
<p>Of these I would prefer to keep the language in Python, there seem to be good alternatives in Java and .Net but I would rather keep an upgrade path by having a language that can be migrated across to these (thanks Jython and IronPython) and keep data in a backend store that is language agnostic.</p>
<p>Orbited and Tornado are really good candidates. I am going to stay away from more raw implementations of non-blocking event based frameworks such as Twisted because efforts are often better at this stage in building to serve a business purpose where possible. Orbited does actually use twisted, and I am hoping that I will have little need to dig that deep except for understanding its implementation.</p>
<p>Tornado I initially didn&#8217;t think of, but came around after reading &#8220;Building the Realtime User Experience&#8221; in which the author, Ted Roden, seems rather partial to it. In fact it can work quite well in fronting our application, but I am starting to reconsider based upon two factors. Firstly, even though it itself was built for a largish scale operation (FriendFeed &#8211; now owned by FaceBook), it has little other commercial users behind it and I haven&#8217;t found many examples of usage with integrating with Django, Pylons, Turbogears or Zope in a production environment. Secondly what really turns <a target="_self" href="mailto:tim@nospamplease.timc3.com">me</a> off is the immaturity of its tests. Looking on GitHub even the README shows that little effort has been put into its testing environment, let alone their sporadic coverage.</p>
<p>Twisted on the other hand is extremely mature in both terms of numbers of deployments and its test environment, and this makes Orbited a much better candidate.</p>
<p>I have yet to look at certain other alternatives, such as Diesel, but I have a feeling that I will again come around to start using Orbited.</p>
<p>The other huge plus for <a target="_self" href="mailto:tim@nospamplease.timc3.com">me</a> in using Orbited is that it can use the STOMP protocol, and use RabbitMQ or ActiveMQ. Other parts of our technology stack are starting to use STOMP and I wish to move more operations on to an event queue, which will open up much in terms of flexibility in the future.</p>
<p>Its a pity that &#8220;Building the Realtime User Experience&#8221; was so limited in terms of covering alternatives to Tornado.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.timc3.com/2010/08/16/realtime-web-orbited-vs-tornado/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Seth Godin on the tribes we lead</title>
		<link>http://blog.timc3.com/2009/05/15/seth-godin-on-the-tribes-we-lead/</link>
		<comments>http://blog.timc3.com/2009/05/15/seth-godin-on-the-tribes-we-lead/#comments</comments>
		<pubDate>Fri, 15 May 2009 10:19:44 +0000</pubDate>
		<dc:creator>timc3</dc:creator>
				<category><![CDATA[Websites]]></category>
		<category><![CDATA[Seth Godin]]></category>

		<guid isPermaLink="false">http://blog.timc3.com/?p=608</guid>
		<description><![CDATA[Seth Godin argues the Internet has ended mass marketing and revived a human social unit from the distant past: tribes. Founded on shared ideas and values, tribes give ordinary people the power to lead and make big change. He urges us to do so.]]></description>
			<content:encoded><![CDATA[<p>Really interesting talk by Seth Godin:</p>
<p><object width="446" height="326"><param name="movie" value="http://video.ted.com/assets/player/swf/EmbedPlayer.swf"></param><param name="allowFullScreen" value="true" /><param name="wmode" value="transparent"></param><param name="bgColor" value="#ffffff"></param><param name="flashvars" value="vu=http://video.ted.com/talks/embed/SethGodin_2009-embed_high.flv&#038;su=http://images.ted.com/images/ted/tedindex/embed-posters/SethGodin-2009.embed_thumbnail.jpg&#038;vw=432&#038;vh=240&#038;ap=0&#038;ti=538" /><embed src="http://video.ted.com/assets/player/swf/EmbedPlayer.swf" pluginspace="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" bgColor="#ffffff" width="446" height="326" allowFullScreen="true" flashvars="vu=http://video.ted.com/talks/embed/SethGodin_2009-embed_high.flv&#038;su=http://images.ted.com/images/ted/tedindex/embed-posters/SethGodin-2009.embed_thumbnail.jpg&#038;vw=432&#038;vh=240&#038;ap=0&#038;ti=538"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.timc3.com/2009/05/15/seth-godin-on-the-tribes-we-lead/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter mobile phone number fail</title>
		<link>http://blog.timc3.com/2009/03/18/twitter-mobile-phone-number-fail/</link>
		<comments>http://blog.timc3.com/2009/03/18/twitter-mobile-phone-number-fail/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 08:49:59 +0000</pubDate>
		<dc:creator>timc3</dc:creator>
				<category><![CDATA[Websites]]></category>

		<guid isPermaLink="false">http://blog.timc3.com/?p=573</guid>
		<description><![CDATA[Could someone please tell me exactly how I am supposed to put in my phone number? Seriously something wrong with this. And of course if I click submit it tells me that I should have filled out the number correctly.]]></description>
			<content:encoded><![CDATA[<p>Could someone please tell <a target="_self" href="mailto:tim@nospamplease.timc3.com">me</a> exactly how I am supposed to put in my phone number?</p>
<p><img src="http://blog.timc3.com/wp-content/uploads/2009/03/twitter.png" alt="twitter.png" border="0" width="583" height="489" /></p>
<p>Seriously something wrong with this. And of course if I click submit it tells <a target="_self" href="mailto:tim@nospamplease.timc3.com">me</a> that I should have filled out the number correctly.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.timc3.com/2009/03/18/twitter-mobile-phone-number-fail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook is AOL 2.0</title>
		<link>http://blog.timc3.com/2009/01/08/facebook-is-aol-20/</link>
		<comments>http://blog.timc3.com/2009/01/08/facebook-is-aol-20/#comments</comments>
		<pubDate>Thu, 08 Jan 2009 11:30:09 +0000</pubDate>
		<dc:creator>timc3</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Websites]]></category>

		<guid isPermaLink="false">http://blog.timc3.com/?p=504</guid>
		<description><![CDATA[Facebook is The Borg: &#8220; Much of the activity that used to happen out in the wild unfettered Net, over email, open (XMPP-based) IM and blog posts is now happening inside the Facebook silo. It is AOL 2.0. I avoid the place, but that&#8217;s getting harder. On this current visit I see 7 friend suggestions, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://blogs.law.harvard.edu/doc/2009/01/05/facebook-is-the-borg/#comments">Facebook is The Borg</a>: &#8220;</p>
<p>Much of the activity that used to happen out in the wild unfettered Net, over email, open (XMPP-based) IM and blog posts is now happening inside the Facebook silo. It is AOL 2.0.</p>
<p>I avoid the place, but that&rsquo;s getting harder. On this current visit I see 7 friend suggestions, 273 friend requests, 6 event invitations, 5 good karma from debo requests, 1 good karma request, 220 other requests, 4 new updates, 235 items in my inbox, 7 pokes and 522 friends to start with.</p>
<p>Okay, I just said yes to several friend requests, congratulated a friend on his new twins, and started chatting in FB for the first time.</p>
<p>To FB&rsquo;s credit, it&rsquo;s <a href="http://developers.facebook.com/news.php?blog=1&#038;story=110">working on a Jabber/XMPP interface</a>, so you can chat to FB-based friends through any client that talks XMPP.  That&rsquo;s cool, but The Borg still grows. </p>
<p>I also notice that FB now has a tiny pale gray thumbs-up and thumbs-down for its advertising. When I click on the down thumb (which I always do &mdash; I haven&rsquo;t yet seen a relevant ad), it just says &lsquo;Loading&#8230;&rsquo; in a big box that won&rsquo;t go away.</p>
<p>So I just punched out. I suspect I&rsquo;ll be doing less of that.</p>
<p>&#8221;</p>
<p>(Via <a href="http://blogs.law.harvard.edu/doc">The Doc Searls Weblog</a>.)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.timc3.com/2009/01/08/facebook-is-aol-20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>This is awesome &#8211; Papervision</title>
		<link>http://blog.timc3.com/2008/12/16/this-is-awesome-papervision/</link>
		<comments>http://blog.timc3.com/2008/12/16/this-is-awesome-papervision/#comments</comments>
		<pubDate>Tue, 16 Dec 2008 10:34:58 +0000</pubDate>
		<dc:creator>timc3</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[Augmented reality]]></category>
		<category><![CDATA[desktop]]></category>
		<category><![CDATA[VR]]></category>

		<guid isPermaLink="false">http://blog.timc3.com/?p=495</guid>
		<description><![CDATA[This is really really awesome, and you have to really check it out for your self. Its a little flash application that uses a webcam or other camera attached to your computer to project a little &#8216;Proto&#8217; guy on top of a printed piece of paper. They have even got some code released for it. [...]]]></description>
			<content:encoded><![CDATA[<p>This is really really awesome, and you have to really check it out for your self.</p>
<p><img src="http://blog.timc3.com/wp-content/uploads/2008/12/mewithapet.jpg" alt="MeWithAPet.jpg" border="0" width="528" height="398" /></p>
<p>Its a little flash application that uses a webcam or other camera attached to your computer to project a little &#8216;Proto&#8217; guy on top of a printed piece of paper. They have even got some code released for it.</p>
<p>Check it out here with some images and video, but it really works better to try it yourselves:</p>
<p>http://www.boffswana.com/news/</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.timc3.com/2008/12/16/this-is-awesome-papervision/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>django one form, two models</title>
		<link>http://blog.timc3.com/2008/06/21/django-one-form-two-models/</link>
		<comments>http://blog.timc3.com/2008/06/21/django-one-form-two-models/#comments</comments>
		<pubDate>Sat, 21 Jun 2008 10:25:04 +0000</pubDate>
		<dc:creator>timc3</dc:creator>
				<category><![CDATA[django]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Websites]]></category>

		<guid isPermaLink="false">http://blog.timc3.com/?p=481</guid>
		<description><![CDATA[This post is a work in progress is now working I am glad to say. I have been working on a django site which needs two models updated for one post. It is actually using models very close to that on django-forums and I have created a forms.py file: class ThreadForm&#40;forms.ModelForm&#41;: &#160; &#160; class Meta: [...]]]></description>
			<content:encoded><![CDATA[<p>This post <del>is a work in progress</del> is now working I am glad to say. I have been working on a django site which needs two models updated for one post. It is actually using models very close to that on <a href="http://code.google.com/p/django-forum/">django-forums</a> and I have created a forms.py file:</p>
<div class="codecolorer-container python vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:500px;"><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #ff7700;font-weight:bold;">class</span> ThreadForm<span style="color: black;">&#40;</span>forms.<span style="color: black;">ModelForm</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">class</span> Meta:<br />
&nbsp; &nbsp; &nbsp; &nbsp; model <span style="color: #66cc66;">=</span> Thread<br />
&nbsp; &nbsp; &nbsp; &nbsp; exclude <span style="color: #66cc66;">=</span> <span style="color: black;">&#40;</span><span style="color: #483d8b;">'forum'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'sticky'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'closed'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'posts'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'views'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'latest_post_time'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">def</span> clean_title<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; title <span style="color: #66cc66;">=</span> <span style="color: #008000;">self</span>.<span style="color: black;">cleaned_data</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'title'</span><span style="color: black;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> alnum_re.<span style="color: black;">search</span><span style="color: black;">&#40;</span>title<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">raise</span> forms.<span style="color: black;">ValidationError</span><span style="color: black;">&#40;</span>ugettext<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Titles can only contain letters, numbers and underscores&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>title<span style="color: black;">&#41;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">1</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">raise</span> forms.<span style="color: black;">ValidationError</span><span style="color: black;">&#40;</span>ugettext<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Please enter a title&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> title<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
<span style="color: #ff7700;font-weight:bold;">class</span> PostForm<span style="color: black;">&#40;</span>forms.<span style="color: black;">ModelForm</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">class</span> Meta:<br />
&nbsp; &nbsp; &nbsp; &nbsp; model <span style="color: #66cc66;">=</span> Post<br />
&nbsp; &nbsp; &nbsp; &nbsp; exclude <span style="color: #66cc66;">=</span> <span style="color: black;">&#40;</span><span style="color: #483d8b;">'thread'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'author'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'time'</span><span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'related_item'</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">def</span> clean_body<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; body <span style="color: #66cc66;">=</span> <span style="color: #008000;">self</span>.<span style="color: black;">cleaned_data</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'body'</span><span style="color: black;">&#93;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #008000;">len</span><span style="color: black;">&#40;</span>body<span style="color: black;">&#41;</span> <span style="color: #66cc66;">&lt;</span> <span style="color: #ff4500;">1</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">raise</span> forms.<span style="color: black;">ValidationError</span><span style="color: black;">&#40;</span>ugettext<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;Please enter some body text&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> body</div></div>
<p>And then in my views (after importing in the correct models):<br />
</code></p>
<div class="codecolorer-container python vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:500px;"><div class="python codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #66cc66;">@</span>login_required<br />
<span style="color: #ff7700;font-weight:bold;">def</span> groupnewthread<span style="color: black;">&#40;</span>request<span style="color: #66cc66;">,</span> slug<span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; thegroup <span style="color: #66cc66;">=</span> get_object_or_404<span style="color: black;">&#40;</span>GroupsOfUser<span style="color: #66cc66;">,</span> slug<span style="color: #66cc66;">=</span>slug<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> request.<span style="color: black;">method</span> <span style="color: #66cc66;">==</span> <span style="color: #483d8b;">'POST'</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; f <span style="color: #66cc66;">=</span> request.<span style="color: black;">POST</span>.<span style="color: #dc143c;">copy</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; tdata <span style="color: #66cc66;">=</span> <span style="color: black;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'title'</span>: f<span style="color: black;">&#91;</span><span style="color: #483d8b;">'title'</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: black;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; pdata <span style="color: #66cc66;">=</span> <span style="color: black;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #483d8b;">'body'</span>: f<span style="color: black;">&#91;</span><span style="color: #483d8b;">'body'</span><span style="color: black;">&#93;</span><span style="color: #66cc66;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: black;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; t <span style="color: #66cc66;">=</span> ThreadForm<span style="color: black;">&#40;</span>tdata<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; p <span style="color: #66cc66;">=</span> PostForm<span style="color: black;">&#40;</span>pdata<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> t.<span style="color: black;">is_valid</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newthread <span style="color: #66cc66;">=</span> t.<span style="color: black;">save</span><span style="color: black;">&#40;</span>commit<span style="color: #66cc66;">=</span><span style="color: #008000;">False</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newthread.<span style="color: black;">forum</span> <span style="color: #66cc66;">=</span> thegroup<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">if</span> p.<span style="color: black;">is_valid</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newthread.<span style="color: black;">save</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newpost <span style="color: #66cc66;">=</span> p.<span style="color: black;">save</span><span style="color: black;">&#40;</span>commit<span style="color: #66cc66;">=</span><span style="color: #008000;">False</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newpost.<span style="color: #dc143c;">thread</span> <span style="color: #66cc66;">=</span> newthread<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newpost.<span style="color: black;">author</span> <span style="color: #66cc66;">=</span> request.<span style="color: #dc143c;">user</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; newpost.<span style="color: black;">save</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; strmessage <span style="color: #66cc66;">=</span> <span style="color: #483d8b;">'has created a thread &lt;a href=&quot;%s&quot;&gt;%s&lt;/a&gt;'</span> % <span style="color: black;">&#40;</span>newthread.<span style="color: black;">get_absolute_url</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">,</span> newthread.<span style="color: black;">title</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; usm <span style="color: #66cc66;">=</span> UserStatus<span style="color: black;">&#40;</span><span style="color: #dc143c;">user</span> <span style="color: #66cc66;">=</span> newpost.<span style="color: black;">author</span><span style="color: #66cc66;">,</span> message <span style="color: #66cc66;">=</span> strmessage<span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; usm.<span style="color: black;">save</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> HttpResponseRedirect<span style="color: black;">&#40;</span>reverse<span style="color: black;">&#40;</span><span style="color: #483d8b;">'groupdetail'</span><span style="color: #66cc66;">,</span> args<span style="color: #66cc66;">=</span><span style="color: black;">&#91;</span>thegroup.<span style="color: black;">slug</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">else</span>:<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; t <span style="color: #66cc66;">=</span> ThreadForm<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; p <span style="color: #66cc66;">=</span> PostForm<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; objContext <span style="color: #66cc66;">=</span> RequestContext<span style="color: black;">&#40;</span>request<span style="color: #66cc66;">,</span> <span style="color: black;">&#123;</span><span style="color: #483d8b;">'threadform'</span>: t<span style="color: #66cc66;">,</span> <span style="color: #483d8b;">'postform'</span>: p<span style="color: black;">&#125;</span><span style="color: black;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #ff7700;font-weight:bold;">return</span> render_to_response<span style="color: black;">&#40;</span><span style="color: #483d8b;">'groups/group_thread_add.html'</span><span style="color: #66cc66;">,</span> objContext<span style="color: black;">&#41;</span></div></div>
<p>Now the bit that is in progress is the returning part of dealing with the form data being bound, but I am going to write a custom handler. This is obviously going to be much easier to handle than an update, which I will have to deal with at a point.</p>
<p>The form HTML looks like this btw:</p>
<div class="codecolorer-container html4strict vibrant" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:500px;"><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">{% extends &quot;base.html&quot; %}<br />
{% load i18n %}<br />
{% block title %}<br />
&nbsp; &nbsp; {% trans 'Add a new group thread' %} <br />
{% endblock %}<br />
{% block body %}<br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/h1.html"><span style="color: #000000; font-weight: bold;">h1</span></a>&gt;</span>{% trans 'Create a new group thread' %}<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/h1.html"><span style="color: #000000; font-weight: bold;">h1</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;column span-14&quot;</span>&gt;</span><br />
&nbsp; &nbsp; {% if t.errors %}<br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/h3.html"><span style="color: #000000; font-weight: bold;">h3</span></a>&gt;</span>{% blocktrans count t.errors|length as count %}Please correct the following error:{% plural %}Please correct the following errors:{% endblocktrans %}<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/h3.html"><span style="color: #000000; font-weight: bold;">h3</span></a>&gt;</span><br />
&nbsp; &nbsp; {% endif %} <br />
&nbsp; &nbsp; {% if p.errors %}<br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/h3.html"><span style="color: #000000; font-weight: bold;">h3</span></a>&gt;</span>{% blocktrans count p.errors|length as count %}Please correct the following error:{% plural %}Please correct the following errors:{% endblocktrans %}<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/h3.html"><span style="color: #000000; font-weight: bold;">h3</span></a>&gt;</span><br />
&nbsp; &nbsp; {% endif %}<br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">table</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/form.html"><span style="color: #000000; font-weight: bold;">form</span></a> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;.&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; {{ threadform.as_table }}<br />
&nbsp; &nbsp; &nbsp; &nbsp; {{ postform.as_table }}<br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a>&gt;&lt;<a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;&lt;<a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;&lt;<a href="http://december.com/html/4/element/input.html"><span style="color: #000000; font-weight: bold;">input</span></a> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;{% trans &quot;</span>Update<span style="color: #ff0000;">&quot; %}&quot;</span><span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/td.html"><span style="color: #000000; font-weight: bold;">td</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/tr.html"><span style="color: #000000; font-weight: bold;">tr</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/form.html"><span style="color: #000000; font-weight: bold;">form</span></a>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/table.html"><span style="color: #000000; font-weight: bold;">table</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span><br />
{% endblock %}</div></div>
]]></content:encoded>
			<wfw:commentRss>http://blog.timc3.com/2008/06/21/django-one-form-two-models/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Looks like Django is really taking off</title>
		<link>http://blog.timc3.com/2008/04/18/looks-like-django-is-really-taking-off/</link>
		<comments>http://blog.timc3.com/2008/04/18/looks-like-django-is-really-taking-off/#comments</comments>
		<pubDate>Fri, 18 Apr 2008 09:42:56 +0000</pubDate>
		<dc:creator>timc3</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Websites]]></category>

		<guid isPermaLink="false">http://blog.timc3.com/2008/04/18/looks-like-django-is-really-taking-off/</guid>
		<description><![CDATA[Since the introduction of Google&#8217;s appengine which includes support for some of Django&#8217;s code, and the template system there has been an incredible amount of press for Django. At the moment there is no backend support for AppEngine in Django (and DB2 support is still lacking &#8211; there was a blog post about a year [...]]]></description>
			<content:encoded><![CDATA[<p>Since the introduction of <a href="http://code.google.com/appengine/">Google&#8217;s appengine</a> which includes support for some of Django&#8217;s code, and the template system there has been an incredible amount of press for Django.</p>
<p>At the moment there is no backend support for AppEngine in Django (and DB2 support is still lacking &#8211; there was a blog post about a year ago but nothing seems to have happened since, and I would love to be proved wrong on that one) but it must only be a matter of time before this happens so for the moment you have to disable the ORM support.  Pity, but I can see why.</p>
<p>But I am glad that Django is getting the attention that it deserves, I have long know that Python is well used in Google (and Yahoo for that matter), and now we should see even more people using Django which can only be a good thing for the ever-growing community.</p>
<p>Here is an excellent write-up on Google App Engine http://www.dougma.com/archives/81</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.timc3.com/2008/04/18/looks-like-django-is-really-taking-off/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 20/73 queries in 0.431 seconds using disk: basic
Object Caching 810/915 objects using disk: basic

Served from: blog.timc3.com @ 2012-02-04 23:22:51 -->
