<?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: Extending the Django User model with inheritance</title>
	<atom:link href="http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/feed/" rel="self" type="application/rss+xml" />
	<link>http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/</link>
	<description>Code and comments on web development, Django, Python and things (un)related.</description>
	<lastBuildDate>Tue, 13 Jul 2010 16:31:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Kalle</title>
		<link>http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/comment-page-2/#comment-794</link>
		<dc:creator>Kalle</dc:creator>
		<pubDate>Sun, 16 May 2010 19:01:45 +0000</pubDate>
		<guid isPermaLink="false">http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/#comment-794</guid>
		<description>Hi Scott,

thanx for the solution - it is exactly what i was seraching for - but somehow it is not working.

When trying to log in the admin site for example, i get the

&lt;pre&gt;
&quot;ImproperlyConfigured at /admin/

Module &quot;mysite.auth_backends&quot; does not define a &quot;CustomUserModelBackend&quot; authentication backend

&lt;/pre&gt;


The auth_backends.py is exactly the same you showed, and the CustomUser is just different in it&#039;s fields (not timezone for example)

My Settings is configured like this:
&lt;pre&gt;
AUTH_PROFILE_MODULE = &#039;mysite..user_ext&#039;

AUTHENTICATION_BACKENDS = (
    &#039;mysite.auth_backends.CustomUserModelBackend&#039;,
)
&lt;/pre&gt;


Any ideas? I want to feel the magic pony ;)

Regards,
Kalle</description>
		<content:encoded><![CDATA[<p>Hi Scott,</p>
<p>thanx for the solution &#8211; it is exactly what i was seraching for &#8211; but somehow it is not working.</p>
<p>When trying to log in the admin site for example, i get the</p>
<pre>
"ImproperlyConfigured at /admin/

Module "mysite.auth_backends" does not define a "CustomUserModelBackend" authentication backend
</pre>
<p>The auth_backends.py is exactly the same you showed, and the CustomUser is just different in it&#8217;s fields (not timezone for example)</p>
<p>My Settings is configured like this:</p>
<pre>
AUTH_PROFILE_MODULE = 'mysite..user_ext'

AUTHENTICATION_BACKENDS = (
    'mysite.auth_backends.CustomUserModelBackend',
)
</pre>
<p>Any ideas? I want to feel the magic pony ;)</p>
<p>Regards,<br />
Kalle</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Extending the Django User model &#60; WebIT.ca</title>
		<link>http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/comment-page-2/#comment-789</link>
		<dc:creator>Extending the Django User model &#60; WebIT.ca</dc:creator>
		<pubDate>Thu, 06 May 2010 02:33:10 +0000</pubDate>
		<guid isPermaLink="false">http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/#comment-789</guid>
		<description>[...] Original Source [...]</description>
		<content:encoded><![CDATA[<p>[...] Original Source [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Регистрация и идентификация пользователей</title>
		<link>http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/comment-page-2/#comment-780</link>
		<dc:creator>Регистрация и идентификация пользователей</dc:creator>
		<pubDate>Thu, 08 Apr 2010 06:46:32 +0000</pubDate>
		<guid isPermaLink="false">http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/#comment-780</guid>
		<description>[...] 0    0        Хочу узнать как лучше регистрировать пользователей на сайте, которым будет закрыт доступ к админке, но с использованием джанговской идентификации.Есть такое приложение — django-registration http://code.google.com/p/django-registration/. Оно предоставляет все необходимое для регистрации пользователей с активацией аккаунта через почту.Все зарегистрированные пользователи будут вперемешку с администраторами в списке ПользователиВ админке есть фильтры =) Поставьте фильтрацию по «Статусу персонала».Модель User имеет ограниченный набор полейДа, можно воспользоваться расширением через UserProfile, а некоторые наследуют от стандартного User свой класс — http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/. [...]</description>
		<content:encoded><![CDATA[<p>[...] 0    0        Хочу узнать как лучше регистрировать пользователей на сайте, которым будет закрыт доступ к админке, но с использованием джанговской идентификации.Есть такое приложение — django-registration <a href="http://code.google.com/p/django-registration/" rel="nofollow">http://code.google.com/p/django-registration/</a>. Оно предоставляет все необходимое для регистрации пользователей с активацией аккаунта через почту.Все зарегистрированные пользователи будут вперемешку с администраторами в списке ПользователиВ админке есть фильтры =) Поставьте фильтрацию по «Статусу персонала».Модель User имеет ограниченный набор полейДа, можно воспользоваться расширением через UserProfile, а некоторые наследуют от стандартного User свой класс — <a href="http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/" rel="nofollow">http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/</a>. [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: bufh</title>
		<link>http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/comment-page-2/#comment-766</link>
		<dc:creator>bufh</dc:creator>
		<pubDate>Wed, 20 Jan 2010 16:12:56 +0000</pubDate>
		<guid isPermaLink="false">http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/#comment-766</guid>
		<description>Hi,

thank you for this article.

Unfortunately i&#039;m having an issue; i&#039;m able to create a CustomUser through the admin interface (like described in comment #8).
But the CustomUsers will appears in admin/auth/user/ (without the custom fields) and nothing will appear in admin/myapp/customuser/.

Is there a clean way to fully add/list/edit extended users through the admin interface or must i make my own admin interface?</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>thank you for this article.</p>
<p>Unfortunately i&#8217;m having an issue; i&#8217;m able to create a CustomUser through the admin interface (like described in comment #8).<br />
But the CustomUsers will appears in admin/auth/user/ (without the custom fields) and nothing will appear in admin/myapp/customuser/.</p>
<p>Is there a clean way to fully add/list/edit extended users through the admin interface or must i make my own admin interface?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Karol Joc</title>
		<link>http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/comment-page-2/#comment-752</link>
		<dc:creator>Karol Joc</dc:creator>
		<pubDate>Mon, 21 Dec 2009 11:42:54 +0000</pubDate>
		<guid isPermaLink="false">http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/#comment-752</guid>
		<description>I have found one problem with apply this new extension to the User class. Maybe there is a simple solution to it..

When I create a foreign key to the new CustomUser class and specify &quot;to_field = &#039;username&#039;&quot; it works fine with validation and saving but the moment you try and do a order_by on the new model which references a field in the User model it fails with customuser__username  field not found. 

Example:

&lt;pre&gt;class CustomUser(User):
    ......

class X(models.Model):
    added_by = models.ForeignKey(CustomUser, to_field = &#039;username&#039;)

X.objects.all().order_by(&#039;added_by__last_name)
&lt;/pre&gt;
I use auto complete fields in my forms that use the username as a value so if I don&#039;t specify to_field in my model the validation will fail as it&#039;s expecting the CustomUser.id.

Maybe there is a way to tell the ModelForm to validate using the username?</description>
		<content:encoded><![CDATA[<p>I have found one problem with apply this new extension to the User class. Maybe there is a simple solution to it..</p>
<p>When I create a foreign key to the new CustomUser class and specify &#8220;to_field = &#8216;username&#8217;&#8221; it works fine with validation and saving but the moment you try and do a order_by on the new model which references a field in the User model it fails with customuser__username  field not found. </p>
<p>Example:</p>
<pre>class CustomUser(User):
    ......

class X(models.Model):
    added_by = models.ForeignKey(CustomUser, to_field = 'username')

X.objects.all().order_by('added_by__last_name)
</pre>
<p>I use auto complete fields in my forms that use the username as a value so if I don&#8217;t specify to_field in my model the validation will fail as it&#8217;s expecting the CustomUser.id.</p>
<p>Maybe there is a way to tell the ModelForm to validate using the username?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Django: Model Inheritance or Related Tables wrt AMO at Spindrop</title>
		<link>http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/comment-page-2/#comment-747</link>
		<dc:creator>Django: Model Inheritance or Related Tables wrt AMO at Spindrop</dc:creator>
		<pubDate>Tue, 15 Dec 2009 20:12:30 +0000</pubDate>
		<guid isPermaLink="false">http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/#comment-747</guid>
		<description>[...] other things we wanted, so it made sense for us to use it. The next question is whether we try the inheritance approach or do we treat our legacy users table as a sort of User Profile and utilize the User module using [...]</description>
		<content:encoded><![CDATA[<p>[...] other things we wanted, so it made sense for us to use it. The next question is whether we try the inheritance approach or do we treat our legacy users table as a sort of User Profile and utilize the User module using [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bufke</title>
		<link>http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/comment-page-2/#comment-742</link>
		<dc:creator>Bufke</dc:creator>
		<pubDate>Sat, 28 Nov 2009 00:37:54 +0000</pubDate>
		<guid isPermaLink="false">http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/#comment-742</guid>
		<description>I found a hack to fix the createsuperuser and other problems when one creates a user instead of the custom user.  Just use a sql trigger(I use mysql).  Something like

delimiter //
create trigger trigger_custom_user
after insert on auth_user
for each row
begin
insert into myapp_customuser (user_ptr_id) values(NEW.id);
//

It&#039;s at the sql level and therefore not ideal, but it works.</description>
		<content:encoded><![CDATA[<p>I found a hack to fix the createsuperuser and other problems when one creates a user instead of the custom user.  Just use a sql trigger(I use mysql).  Something like</p>
<p>delimiter //<br />
create trigger trigger_custom_user<br />
after insert on auth_user<br />
for each row<br />
begin<br />
insert into myapp_customuser (user_ptr_id) values(NEW.id);<br />
//</p>
<p>It&#8217;s at the sql level and therefore not ideal, but it works.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MarioGonzalez</title>
		<link>http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/comment-page-2/#comment-726</link>
		<dc:creator>MarioGonzalez</dc:creator>
		<pubDate>Thu, 01 Oct 2009 22:43:16 +0000</pubDate>
		<guid isPermaLink="false">http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/#comment-726</guid>
		<description>$ python manage.py createsuperuser does not &#039;obey&#039; this configuration it stills create the user in User model. Is that a support lack or is there something I&#039;m doing wrong?</description>
		<content:encoded><![CDATA[<p>$ python manage.py createsuperuser does not &#8216;obey&#8217; this configuration it stills create the user in User model. Is that a support lack or is there something I&#8217;m doing wrong?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joel</title>
		<link>http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/comment-page-2/#comment-713</link>
		<dc:creator>Joel</dc:creator>
		<pubDate>Wed, 09 Sep 2009 20:30:45 +0000</pubDate>
		<guid isPermaLink="false">http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/#comment-713</guid>
		<description>Hacked this a bit to allow the backend to assign a user subclass based on the user&#039;s group attribute.

http://steps.ucdavis.edu/People/jbremson/extending-the-user-model-in-django</description>
		<content:encoded><![CDATA[<p>Hacked this a bit to allow the backend to assign a user subclass based on the user&#8217;s group attribute.</p>
<p><a href="http://steps.ucdavis.edu/People/jbremson/extending-the-user-model-in-django" rel="nofollow">http://steps.ucdavis.edu/People/jbremson/extending-the-user-model-in-django</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason</title>
		<link>http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/comment-page-2/#comment-712</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Wed, 09 Sep 2009 06:44:59 +0000</pubDate>
		<guid isPermaLink="false">http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/#comment-712</guid>
		<description>I just wanted to say thank you. This is an elegant solution to a common problem.</description>
		<content:encoded><![CDATA[<p>I just wanted to say thank you. This is an elegant solution to a common problem.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

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