<?xml version="1.0" encoding="utf-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Copy Model Object in Django</title>
	<atom:link href="http://www.nerdydork.com/copy-model-object-in-django.html/feed" rel="self" type="application/rss+xml" />
	<link>http://www.nerdydork.com/copy-model-object-in-django.html</link>
	<description>Dustin Davis reviews... the internet.</description>
	<lastBuildDate>Mon, 06 Feb 2012 13:23:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: A Kozin</title>
		<link>http://www.nerdydork.com/copy-model-object-in-django.html/comment-page-1#comment-7908</link>
		<dc:creator>A Kozin</dc:creator>
		<pubDate>Mon, 12 Dec 2011 15:07:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.nerdydork.com/copy-model-object-in-django.html#comment-7908</guid>
		<description>Thank you so much!!</description>
		<content:encoded><![CDATA[<p>Thank you so much!!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: 5440794</title>
		<link>http://www.nerdydork.com/copy-model-object-in-django.html/comment-page-1#comment-7825</link>
		<dc:creator>5440794</dc:creator>
		<pubDate>Fri, 30 Sep 2011 08:39:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.nerdydork.com/copy-model-object-in-django.html#comment-7825</guid>
		<description>good!
while i have another question like this one. say ,there is tb and tb_bak,they are of the same DDL(model).
i want to copy a record from tb to tb_bak,how can i do that ?
old_rcd = tb.objects.get(ipaddr=applyip_id)
new_rcd = tb_bak()
new_rcd = deepcopy(old_rcd)   #&lt;== problem 
new_rcd.id = None
new_rcd.save()
this does&#039;t work,it just copy old_rcd to new_rcd in the tb !
type(new_rcd) is : tb object !???
</description>
		<content:encoded><![CDATA[<p>good!<br />
while i have another question like this one. say ,there is tb and tb_bak,they are of the same DDL(model).<br />
i want to copy a record from tb to tb_bak,how can i do that ?<br />
old_rcd = tb.objects.get(ipaddr=applyip_id)<br />
new_rcd = tb_bak()<br />
new_rcd = deepcopy(old_rcd)   #&lt;== problem <br />
new_rcd.id = None<br />
new_rcd.save()<br />
this does&#039;t work,it just copy old_rcd to new_rcd in the tb !<br />
type(new_rcd) is : tb object !???</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bingting chen</title>
		<link>http://www.nerdydork.com/copy-model-object-in-django.html/comment-page-1#comment-7802</link>
		<dc:creator>bingting chen</dc:creator>
		<pubDate>Tue, 23 Aug 2011 02:39:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.nerdydork.com/copy-model-object-in-django.html#comment-7802</guid>
		<description> &lt;a href=&quot;http://www.brand-boots.com&quot; title=&quot; Brand boots &quot; rel=&quot;nofollow&quot;&gt; Brand boots
&lt;/a&gt; we are all worship. We have many brand of things in &lt;a&gt; http://www.brand-boots.com &lt;/a&gt; They combine brands and fashion. So take
the time what we have to say on these cool looking boots.Various Brand Boots
Available Now!</description>
		<content:encoded><![CDATA[<p> <a href="http://www.brand-boots.com" title=" Brand boots " rel="nofollow"> Brand boots<br />
</a> we are all worship. We have many brand of things in <a> </a><a href="http://www.brand-boots.com" rel="nofollow">http://www.brand-boots.com</a>  They combine brands and fashion. So take<br />
the time what we have to say on these cool looking boots.Various Brand Boots<br />
Available Now!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike Cooper</title>
		<link>http://www.nerdydork.com/copy-model-object-in-django.html/comment-page-1#comment-7799</link>
		<dc:creator>Mike Cooper</dc:creator>
		<pubDate>Thu, 18 Aug 2011 20:22:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.nerdydork.com/copy-model-object-in-django.html#comment-7799</guid>
		<description>This doesn&#039;t work for me. The object just gets modified and gets the same id.

But then again, neither does deep copy.</description>
		<content:encoded><![CDATA[<p>This doesn&#8217;t work for me. The object just gets modified and gets the same id.</p>
<p>But then again, neither does deep copy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Guest</title>
		<link>http://www.nerdydork.com/copy-model-object-in-django.html/comment-page-1#comment-7792</link>
		<dc:creator>Guest</dc:creator>
		<pubDate>Fri, 05 Aug 2011 16:54:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.nerdydork.com/copy-model-object-in-django.html#comment-7792</guid>
		<description>Even better:

obj.id = None

obj.save()



Setting the id to None will automatically create a new record in the table</description>
		<content:encoded><![CDATA[<p>Even better:</p>
<p>obj.id = None</p>
<p>obj.save()</p>
<p>Setting the id to None will automatically create a new record in the table</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Horia Horia</title>
		<link>http://www.nerdydork.com/copy-model-object-in-django.html/comment-page-1#comment-7689</link>
		<dc:creator>Horia Horia</dc:creator>
		<pubDate>Wed, 01 Jun 2011 05:16:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.nerdydork.com/copy-model-object-in-django.html#comment-7689</guid>
		<description>Thanks for sharing this! </description>
		<content:encoded><![CDATA[<p>Thanks for sharing this!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sanjay</title>
		<link>http://www.nerdydork.com/copy-model-object-in-django.html/comment-page-1#comment-7675</link>
		<dc:creator>Sanjay</dc:creator>
		<pubDate>Sun, 15 May 2011 11:40:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.nerdydork.com/copy-model-object-in-django.html#comment-7675</guid>
		<description> thanks, deepcopy is a nice trick and saved me some hassle :) - have to add, Seveas is the most amazing human being :P - I remember 5-6 years ago when I was a complete noobie and having problems with an ubuntu install, Seveas on IRC really sorted me out - amazing unsung heroes on IRC :P - sorry for the OT, had to say that ..</description>
		<content:encoded><![CDATA[<p> thanks, deepcopy is a nice trick and saved me some hassle <img src='http://www.nerdydork.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  &#8211; have to add, Seveas is the most amazing human being <img src='http://www.nerdydork.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  &#8211; I remember 5-6 years ago when I was a complete noobie and having problems with an ubuntu install, Seveas on IRC really sorted me out &#8211; amazing unsung heroes on IRC <img src='http://www.nerdydork.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' />  &#8211; sorry for the OT, had to say that ..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Jeracevich</title>
		<link>http://www.nerdydork.com/copy-model-object-in-django.html/comment-page-1#comment-6433</link>
		<dc:creator>John Jeracevich</dc:creator>
		<pubDate>Wed, 30 Dec 2009 05:29:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.nerdydork.com/copy-model-object-in-django.html#comment-6433</guid>
		<description>ith the exception of CONTENT_LENGTH and CONTENT_TYPE, as given above, any HTTP headers in the request are converted to META keys by converting all characters to uppercase, replacing any hyphens with underscores and adding an HTTP_ prefix to the name. So, for example, a header called X-Bender would be mapped to the META key HTTP_X_BENDER.</description>
		<content:encoded><![CDATA[<p>ith the exception of CONTENT_LENGTH and CONTENT_TYPE, as given above, any HTTP headers in the request are converted to META keys by converting all characters to uppercase, replacing any hyphens with underscores and adding an HTTP_ prefix to the name. So, for example, a header called X-Bender would be mapped to the META key HTTP_X_BENDER.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Daniel@Abs Workout</title>
		<link>http://www.nerdydork.com/copy-model-object-in-django.html/comment-page-1#comment-6432</link>
		<dc:creator>Mark Daniel@Abs Workout</dc:creator>
		<pubDate>Wed, 30 Dec 2009 05:28:40 +0000</pubDate>
		<guid isPermaLink="false">http://www.nerdydork.com/copy-model-object-in-django.html#comment-6432</guid>
		<description>A readable-and-writable, dictionary-like object that represents the current session. This is only available if your Django installation has session support activated. See the session documentation for full details.</description>
		<content:encoded><![CDATA[<p>A readable-and-writable, dictionary-like object that represents the current session. This is only available if your Django installation has session support activated. See the session documentation for full details.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Chris Mladenovski@Personalised Wine</title>
		<link>http://www.nerdydork.com/copy-model-object-in-django.html/comment-page-1#comment-6371</link>
		<dc:creator>Chris Mladenovski@Personalised Wine</dc:creator>
		<pubDate>Sat, 19 Dec 2009 13:27:12 +0000</pubDate>
		<guid isPermaLink="false">http://www.nerdydork.com/copy-model-object-in-django.html#comment-6371</guid>
		<description>There is no way to have Django return, say, a MyUser object whenever you query for User objects. A queryset for User objects will return those types of objects. The whole point of proxy objects is that code relying on the original User will use those and your own code can use the extensions you included (that no other code is relying on anyway). It is not a way to replace the User (or any other) model everywhere with something of your own creation.</description>
		<content:encoded><![CDATA[<p>There is no way to have Django return, say, a MyUser object whenever you query for User objects. A queryset for User objects will return those types of objects. The whole point of proxy objects is that code relying on the original User will use those and your own code can use the extensions you included (that no other code is relying on anyway). It is not a way to replace the User (or any other) model everywhere with something of your own creation.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
<!-- This Quick Cache file was built for (  www.nerdydork.com/copy-model-object-in-django.html/feed ) in 0.20444 seconds, on Feb 9th, 2012 at 2:28 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 9th, 2012 at 3:28 am UTC -->
