<?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; admin</title>
	<atom:link href="http://prettyprinted.net/blog/tag/admin/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>SlugField and Django 1.0</title>
		<link>http://prettyprinted.net/blog/slugfield-and-django-1-0/</link>
		<comments>http://prettyprinted.net/blog/slugfield-and-django-1-0/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 18:02:12 +0000</pubDate>
		<dc:creator>steingrd</dc:creator>
				<category><![CDATA[django]]></category>
		<category><![CDATA[admin]]></category>

		<guid isPermaLink="false">http://prettyprinted.net/wp/?p=3</guid>
		<description><![CDATA[I stumbled upon this non-functional fix for using prepopulated admin fields in Django 1.0. If you manage to read the code you&#8217;ll notice that it really does not conform to Django-1.0 standards; it uses old-style inner Admin-classes.
The proper way to do this is of course to use the ModelAdmin classes that were introduced with the [...]]]></description>
			<content:encoded><![CDATA[<p>I stumbled upon <a href="http://innovationsopen.com/?p=31">this non-functional</a> fix for using prepopulated admin fields in Django 1.0. If you manage to read the code you&#8217;ll notice that it really does not conform to Django-1.0 standards; it uses old-style inner <code>Admin</code>-classes.</p>
<p>The <em>proper</em> way to do this is of course to use the <code>ModelAdmin</code> classes that were introduced with the merge of the newforms-admin branch.</p>
<p>Declare your model as usual in <code>models.py</code> <em>without</em> the inner Admin class:</p>
<pre>class Article(models.Model):
    title = models.CharField()
    slug = models.SlugField()
</pre>
<p>Then declare the <code>ModelAdmin</code> class in <code>admins.py</code>. This is where you set properties regarding the admin interface, it replaces the old-style inner <code>Admin</code> class:</p>
<pre>class ArticleAdmin(admin.ModelAdmin):
    prepopulated_fields = {"slug": ("title",)}
admin.site.register(Article, ArticleAdmin)</pre>
<p>This is the <em>correct</em> way to do it. Rip out the inner <code>Admin</code>-classes and create new <code>ModelAdmin</code>-classes. Read the new and updated <a href="http://docs.djangoproject.com/en/dev/ref/contrib/admin/">documentation</a> for more on newforms-admin.</p>
]]></content:encoded>
			<wfw:commentRss>http://prettyprinted.net/blog/slugfield-and-django-1-0/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
