<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>
<channel>
	<title>Comments on: Dynamic upload paths in Django</title>
	<link>http://scottbarnham.com/blog/2008/08/25/dynamic-upload-paths-in-django/</link>
	<description>Code and comments on web development, Django, Python and things (un)related.</description>
	<pubDate>Wed, 07 Jan 2009 05:03:56 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.3.3</generator>
		<item>
		<title>By: Bulak</title>
		<link>http://scottbarnham.com/blog/2008/08/25/dynamic-upload-paths-in-django/#comment-606</link>
		<dc:creator>Bulak</dc:creator>
		<pubDate>Sat, 27 Dec 2008 15:15:01 +0000</pubDate>
		<guid>http://scottbarnham.com/blog/2008/08/25/dynamic-upload-paths-in-django/#comment-606</guid>
		<description>Thanks a lot for both the code and the decent guide-through. Nice, simple code and works perfectly.</description>
		<content:encoded><![CDATA[<p>Thanks a lot for both the code and the decent guide-through. Nice, simple code and works perfectly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kellen</title>
		<link>http://scottbarnham.com/blog/2008/08/25/dynamic-upload-paths-in-django/#comment-478</link>
		<dc:creator>Kellen</dc:creator>
		<pubDate>Mon, 15 Sep 2008 16:57:14 +0000</pubDate>
		<guid>http://scottbarnham.com/blog/2008/08/25/dynamic-upload-paths-in-django/#comment-478</guid>
		<description>NOTE (OBS!): If you are using this method with a ModelForm, and using data from the fields for your filename, your image field MUST come after (in the model) the other fields you want to access in creating the filename. The fields in the instance which is passed into your callable are filled out in order of declaration, so if your image is defined first, the instance will have EMPTY STRINGS for all other fields and you will get an EMPTY FILENAME.</description>
		<content:encoded><![CDATA[<p>NOTE (OBS!): If you are using this method with a ModelForm, and using data from the fields for your filename, your image field MUST come after (in the model) the other fields you want to access in creating the filename. The fields in the instance which is passed into your callable are filled out in order of declaration, so if your image is defined first, the instance will have EMPTY STRINGS for all other fields and you will get an EMPTY FILENAME.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bjorn</title>
		<link>http://scottbarnham.com/blog/2008/08/25/dynamic-upload-paths-in-django/#comment-355</link>
		<dc:creator>Bjorn</dc:creator>
		<pubDate>Tue, 02 Sep 2008 12:32:27 +0000</pubDate>
		<guid>http://scottbarnham.com/blog/2008/08/25/dynamic-upload-paths-in-django/#comment-355</guid>
		<description>Thanks alot! I've a bunch of these CustomImageField hacks, and I'm just starting to update them, but first needed to get up-to-date on the refactoring stuff. You've really made it easier for me.</description>
		<content:encoded><![CDATA[<p>Thanks alot! I&#8217;ve a bunch of these CustomImageField hacks, and I&#8217;m just starting to update them, but first needed to get up-to-date on the refactoring stuff. You&#8217;ve really made it easier for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott</title>
		<link>http://scottbarnham.com/blog/2008/08/25/dynamic-upload-paths-in-django/#comment-340</link>
		<dc:creator>Scott</dc:creator>
		<pubDate>Mon, 01 Sep 2008 08:18:22 +0000</pubDate>
		<guid>http://scottbarnham.com/blog/2008/08/25/dynamic-upload-paths-in-django/#comment-340</guid>
		<description>@Kevin Holzer

I don't see a good way around that, Kevin.  Admin is getting all the field values (including the upload_to path) before saving.  Before the first save, there is no id for you to use.  In your own views, you get to create the model instance first and then save the image, but not with admin.

If there's another field you can use, such as a slug, that's probably the best alternative.  Otherwise, you could upload to a temporary path and respond to the post_save signal by moving the image to its proper location.</description>
		<content:encoded><![CDATA[<p>@Kevin Holzer</p>
<p>I don&#8217;t see a good way around that, Kevin.  Admin is getting all the field values (including the upload_to path) before saving.  Before the first save, there is no id for you to use.  In your own views, you get to create the model instance first and then save the image, but not with admin.</p>
<p>If there&#8217;s another field you can use, such as a slug, that&#8217;s probably the best alternative.  Otherwise, you could upload to a temporary path and respond to the post_save signal by moving the image to its proper location.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kevin Holzer</title>
		<link>http://scottbarnham.com/blog/2008/08/25/dynamic-upload-paths-in-django/#comment-330</link>
		<dc:creator>Kevin Holzer</dc:creator>
		<pubDate>Sun, 31 Aug 2008 08:49:01 +0000</pubDate>
		<guid>http://scottbarnham.com/blog/2008/08/25/dynamic-upload-paths-in-django/#comment-330</guid>
		<description>For some reason, whenever one posts a new image (I am doing this from the admin interface) using the above method, instance.id returns None, which then gets inserted in my upload_to path where I thought instance.id should have gone...  Do you have any recommendations as to what I should do?  I've been playing with this a &lt;em&gt;lot&lt;/em&gt;, and I've had no luck.  Thank you very much!</description>
		<content:encoded><![CDATA[<p>For some reason, whenever one posts a new image (I am doing this from the admin interface) using the above method, instance.id returns None, which then gets inserted in my upload_to path where I thought instance.id should have gone&#8230;  Do you have any recommendations as to what I should do?  I&#8217;ve been playing with this a <em>lot</em>, and I&#8217;ve had no luck.  Thank you very much!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ilya</title>
		<link>http://scottbarnham.com/blog/2008/08/25/dynamic-upload-paths-in-django/#comment-308</link>
		<dc:creator>ilya</dc:creator>
		<pubDate>Wed, 27 Aug 2008 08:26:36 +0000</pubDate>
		<guid>http://scottbarnham.com/blog/2008/08/25/dynamic-upload-paths-in-django/#comment-308</guid>
		<description>Thanks for example Scott, there are really lots of new features since refactoring!</description>
		<content:encoded><![CDATA[<p>Thanks for example Scott, there are really lots of new features since refactoring!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.146 seconds -->
