<?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>Prettyprinted &#187; django-plist</title>
	<atom:link href="http://prettyprinted.net/blog/tag/django-plist/feed/" rel="self" type="application/rss+xml" />
	<link>http://prettyprinted.net/blog</link>
	<description>Django, Python and Drunken Ramblings</description>
	<lastBuildDate>Thu, 26 Nov 2009 21:45:35 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Pushing Django Objects To The iPhone</title>
		<link>http://prettyprinted.net/blog/pushing-django-objects-to-the-iphone/</link>
		<comments>http://prettyprinted.net/blog/pushing-django-objects-to-the-iphone/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 19:07:45 +0000</pubDate>
		<dc:creator>steingrd</dc:creator>
				<category><![CDATA[django]]></category>
		<category><![CDATA[django-plist]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">http://prettyprinted.net/blog/?p=38</guid>
		<description><![CDATA[iPhone application development often involves writing a web service counterpart that the iPhone application uses. A key issue when writing a web service for iPhone&#8217;s is to figure out how to communicate your server side objects onto your iPhone device. Luckily Cocoa, the application framework for iPhone development, comes with a predefined XML format that store [...]]]></description>
			<content:encoded><![CDATA[<p>iPhone application development often involves writing a web service counterpart that the iPhone application uses. A key issue when writing a web service for iPhone&#8217;s is to figure out how to communicate your server side objects onto your iPhone device. Luckily Cocoa, the application framework for iPhone development, comes with a predefined XML format that store serialized objects and utility methods for deserializing this format into NSArray and NSDictionary objects.</p>
<p>That file format is called <a href="http://en.wikipedia.org/wiki/Property_list">Property List</a> because they often store application properties such as user settings.</p>
<p>This blog post introductes a Django application for serializing Django model objects and regular Python types into Property List XML!</p>
<p>The package is called <a href="http://wiki.github.com/steingrd/django-plist">django-plist</a> and <a href="http://github.com/steingrd/django-plist">the source is available at Github</a>. It is also available from the Python Package Index, install it with <code>easy_install django_plist</code>.</p>
<p>The <a href="http://github.com/steingrd/django-plist/blob/master/README.markdown">README</a> file documents the installation process and how to use the application to serialize Django objects, but I&#8217;ll give a small teaser here, just to get your attention!</p>
<p>Say we have a model Blog and we want to expose all Blog objects as an array of objects at one URL endpoint and single Blog objects as a dictionary at another endpoint. Point your Objective-C code to the URLs and read it with <code>[NSArray arrayWithContentsOfUrl]</code> and <code>[NSDictionary dictionaryWithContentsOfUrl]</code>. And voilá your Python objects are available as arrays and dictionaries in Objective-C!</p>
<p>The main interface for django-plist is two generic views, you&#8217;ll use these views just as you would use the generic views in Django:</p>
<pre>from django_plist.views.generic import plist_array, plist_dict

blog_info = {'queryset': Blog.objects.all()}

urlpatterns = patterns('',
    url('^all_entries/$', plist_array, blog_info),
    url('^single_entry/(?P&lt;object_id&gt;\d+)/$', plist_dict, blog_info),
)</pre>
<p>Read about the different ways you can customize the generic views and the parameters they take in <a href="http://wiki.github.com/steingrd/django-plist">the documentation</a>.</p>
<p>If you find django-plist useful, please drop me a line!</p>
]]></content:encoded>
			<wfw:commentRss>http://prettyprinted.net/blog/pushing-django-objects-to-the-iphone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
