<?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: Extend django&#8217;s User class</title>
	<atom:link href="http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class/feed" rel="self" type="application/rss+xml" />
	<link>http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class</link>
	<description>all the other blogs have such cool names, I don't know one ...</description>
	<pubDate>Fri, 10 Sep 2010 08:37:39 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: fasdfqyety</title>
		<link>http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class/comment-page-1#comment-407278</link>
		<dc:creator>fasdfqyety</dc:creator>
		<pubDate>Tue, 05 Jan 2010 03:29:16 +0000</pubDate>
		<guid isPermaLink="false">http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class#comment-407278</guid>
		<description>&lt;a href="http://hi.baidu.com/huanhuan0727/" rel="nofollow"&gt;福音的空间&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p><a href="http://hi.baidu.com/huanhuan0727/" rel="nofollow">福音的空间</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Extending Django&#8217;s User Profile &#171; Weblog of a bee, thts me VB</title>
		<link>http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class/comment-page-1#comment-403870</link>
		<dc:creator>Extending Django&#8217;s User Profile &#171; Weblog of a bee, thts me VB</dc:creator>
		<pubDate>Fri, 06 Nov 2009 13:14:14 +0000</pubDate>
		<guid isPermaLink="false">http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class#comment-403870</guid>
		<description>[...] 6.&#160;&#160;&#160;&#160;&#160;&#160; http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class [...]</description>
		<content:encoded><![CDATA[<p>[...] 6.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class" rel="nofollow">http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class</a> [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Artur Gajowy</title>
		<link>http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class/comment-page-1#comment-395565</link>
		<dc:creator>Artur Gajowy</dc:creator>
		<pubDate>Tue, 04 Aug 2009 07:00:17 +0000</pubDate>
		<guid isPermaLink="false">http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class#comment-395565</guid>
		<description>For all those, who use django 1.1 and read this - there are the Glorius Proxy Models (http://docs.djangoproject.com/en/dev/topics/db/models/#proxy-models)</description>
		<content:encoded><![CDATA[<p>For all those, who use django 1.1 and read this - there are the Glorius Proxy Models (http://docs.djangoproject.com/en/dev/topics/db/models/#proxy-models)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael</title>
		<link>http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class/comment-page-1#comment-34189</link>
		<dc:creator>Michael</dc:creator>
		<pubDate>Tue, 24 Apr 2007 14:52:19 +0000</pubDate>
		<guid isPermaLink="false">http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class#comment-34189</guid>
		<description>Now the question is, how would manage.py's syncdb handle this.  If you don't have a  user database already made, could you, in theory, add fields by using something like:

class UserExtensions(object):
  blah_field = models.DateField()

User.__bases__ += (UserExtentions,)

I'm guessing that wouldn't work, though it might depend on how, and what order, syncdb builds tables?

I could just be completely off-base, too.  I'm still fairly new to Django.</description>
		<content:encoded><![CDATA[<p>Now the question is, how would manage.py&#8217;s syncdb handle this.  If you don&#8217;t have a  user database already made, could you, in theory, add fields by using something like:</p>
<p>class UserExtensions(object):<br />
  blah_field = models.DateField()</p>
<p>User.__bases__ += (UserExtentions,)</p>
<p>I&#8217;m guessing that wouldn&#8217;t work, though it might depend on how, and what order, syncdb builds tables?</p>
<p>I could just be completely off-base, too.  I&#8217;m still fairly new to Django.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wolfram</title>
		<link>http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class/comment-page-1#comment-33459</link>
		<dc:creator>Wolfram</dc:creator>
		<pubDate>Sat, 21 Apr 2007 19:06:42 +0000</pubDate>
		<guid isPermaLink="false">http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class#comment-33459</guid>
		<description>@Jay that is when you really need the profile, which is another query. in my case i dont need the profile every time, so it would be a waste of query, just for being able to call the one function. 
And btw I think the userprofile thing is also a pretty quick+dirty solution, it bares so many drawbacks. it just doesnt feel natural.</description>
		<content:encoded><![CDATA[<p>@Jay that is when you really need the profile, which is another query. in my case i dont need the profile every time, so it would be a waste of query, just for being able to call the one function.<br />
And btw I think the userprofile thing is also a pretty quick+dirty solution, it bares so many drawbacks. it just doesnt feel natural.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: aaloy</title>
		<link>http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class/comment-page-1#comment-33367</link>
		<dc:creator>aaloy</dc:creator>
		<pubDate>Sat, 21 Apr 2007 08:27:05 +0000</pubDate>
		<guid isPermaLink="false">http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class#comment-33367</guid>
		<description>Thank you for sharing this info with us.
The post itself and the comments are very interesting.

I like the trick/hack and perhaps the way to avoid some suprises if  the Django framwors someday uses the same funtion name could be writing some unit tests for the model that could test the existance of the function.

Other trick, you can use another language to write the hack extensions, for example I would use a name something like get_nombreCorto in Spanish or get_NomCurt in Catalan. The chances that Django some day could use that names are very, very low :) So, its a nice trick for me. 

Thank you.</description>
		<content:encoded><![CDATA[<p>Thank you for sharing this info with us.<br />
The post itself and the comments are very interesting.</p>
<p>I like the trick/hack and perhaps the way to avoid some suprises if  the Django framwors someday uses the same funtion name could be writing some unit tests for the model that could test the existance of the function.</p>
<p>Other trick, you can use another language to write the hack extensions, for example I would use a name something like get_nombreCorto in Spanish or get_NomCurt in Catalan. The chances that Django some day could use that names are very, very low <img src='http://wolfram.kriesing.de/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> So, its a nice trick for me. </p>
<p>Thank you.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay P</title>
		<link>http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class/comment-page-1#comment-33254</link>
		<dc:creator>Jay P</dc:creator>
		<pubDate>Fri, 20 Apr 2007 19:48:27 +0000</pubDate>
		<guid isPermaLink="false">http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class#comment-33254</guid>
		<description>I think that using Django's built AUTH_PROFILE_MODULE would have been the "Django" way of doing this. Wouldn't have involved any monkey-patching, and it would be easy recognizable by any other Django developer using your code.

Your final result would then look something like:

u = User.objects.get(id=3)
u.get_profile().get_shortcut()

See http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model for the best explanation of this technique.</description>
		<content:encoded><![CDATA[<p>I think that using Django&#8217;s built AUTH_PROFILE_MODULE would have been the &#8220;Django&#8221; way of doing this. Wouldn&#8217;t have involved any monkey-patching, and it would be easy recognizable by any other Django developer using your code.</p>
<p>Your final result would then look something like:</p>
<p>u = User.objects.get(id=3)<br />
u.get_profile().get_shortcut()</p>
<p>See <a href="http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model" rel="nofollow">http://www.b-list.org/weblog/2006/06/06/django-tips-extending-user-model</a> for the best explanation of this technique.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wolfram</title>
		<link>http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class/comment-page-1#comment-33198</link>
		<dc:creator>Wolfram</dc:creator>
		<pubDate>Fri, 20 Apr 2007 16:38:33 +0000</pubDate>
		<guid isPermaLink="false">http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class#comment-33198</guid>
		<description>As Martijn is saying, it is quite hacky. But hey I am using the tools I get :-)

Seriously, there is a problem of course when the framework adds a function with the same name, definitely. I got to think about that.

Though I see the solution I posted as valid, as long as you don't mess with the actual User class internals, in whichever way.

The suggested adapter way is of course viable, but i think it adds another class, which actually should not be needed. Instead I think the framework needs to offer the extending mechanism, if default class-extending is occupied otherwise.

@Ben, model inheritance is supposed to do the following:
&lt;pre&gt;&lt;code&gt;
class Place(models.Model):
    name = models.CharField(maxlength=50)

class Restaurant(Place):
    description = models.TextField()

class ItalianRestaurant(Restaurant):
    has_decent_gnocchi = models.BooleanField()
&lt;/code&gt;&lt;/pre&gt;
I can not tell if that is the right path, my gut feeling says no, but thats very subjective!
and described here http://code.djangoproject.com/wiki/ModelInheritance</description>
		<content:encoded><![CDATA[<p>As Martijn is saying, it is quite hacky. But hey I am using the tools I get <img src='http://wolfram.kriesing.de/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Seriously, there is a problem of course when the framework adds a function with the same name, definitely. I got to think about that.</p>
<p>Though I see the solution I posted as valid, as long as you don&#8217;t mess with the actual User class internals, in whichever way.</p>
<p>The suggested adapter way is of course viable, but i think it adds another class, which actually should not be needed. Instead I think the framework needs to offer the extending mechanism, if default class-extending is occupied otherwise.</p>
<p>@Ben, model inheritance is supposed to do the following:</p>
<pre><code>
class Place(models.Model):
    name = models.CharField(maxlength=50)

class Restaurant(Place):
    description = models.TextField()

class ItalianRestaurant(Restaurant):
    has_decent_gnocchi = models.BooleanField()
</code></pre>
<p>I can not tell if that is the right path, my gut feeling says no, but thats very subjective!<br />
and described here <a href="http://code.djangoproject.com/wiki/ModelInheritance" rel="nofollow">http://code.djangoproject.com/wiki/ModelInheritance</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Wolfram</title>
		<link>http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class/comment-page-1#comment-33196</link>
		<dc:creator>Wolfram</dc:creator>
		<pubDate>Fri, 20 Apr 2007 16:30:27 +0000</pubDate>
		<guid isPermaLink="false">http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class#comment-33196</guid>
		<description>@christian 
I am adding that right below the UserFunctions class I wrote, which is locate in my models.py yes.</description>
		<content:encoded><![CDATA[<p>@christian<br />
I am adding that right below the UserFunctions class I wrote, which is locate in my models.py yes.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class/comment-page-1#comment-33191</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Fri, 20 Apr 2007 16:16:14 +0000</pubDate>
		<guid isPermaLink="false">http://wolfram.kriesing.de/blog/index.php/2007/extend-djangos-user-class#comment-33191</guid>
		<description>&gt;Extending a django model is not the way to go, 
&gt;since that has a different meaning here.

Could you explain that a bit more?  I'm new to django...</description>
		<content:encoded><![CDATA[<p>&gt;Extending a django model is not the way to go,<br />
&gt;since that has a different meaning here.</p>
<p>Could you explain that a bit more?  I&#8217;m new to django&#8230;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
