On Tue, Mar 3, 2009 at 12:54 PM, Alex Gaynor <alex.gay...@gmail.com> wrote:

>
>
> On Tue, Mar 3, 2009 at 12:41 PM, Brandon Taylor 
> <btaylordes...@gmail.com>wrote:
>
>>
>> Hi everyone,
>>
>> Not sure what's up here, the same code works on another site.
>> Basically what I'm doing is adding an inline model form to the User
>> change form...
>>
>> from django.db import models
>> from django.contrib import admin
>> from django.contrib.auth.models import User
>> from django.contrib.auth.admin import UserAdmin
>>
>> class UserProfile(models.Model):
>>    user = models.ForeignKey(User, unique=True, blank=True, null=True)
>>    receives_job_seeker_emails = models.BooleanField(blank=True)
>>
>>    class Meta:
>>        verbose_name = 'Admin User Profile'
>>        verbose_name_plural = 'Admin User Profile'
>>
>>    def __unicode__(self):
>>        return ''
>>
>> class UserProfileInline(admin.TabularInline):
>>    model = UserProfile
>>    fk_name = 'user'
>>    max_num = 1
>>
>> class UserProfileAdmin(UserAdmin):
>>    inlines = [UserProfileInline]
>>
>> admin.site.unregister(User)
>> admin.site.register(User, UserProfileAdmin)
>>
>>
>> But, admin.site.unregister(User) is throwing an error on validation:
>> django.contrib.admin.sites.NotRegistered: The model User is not
>> registered
>>
>> I have the UserProfile app module added to my installed apps, same as
>> my other project, and that one validates. Can someone see what I'm
>> doing wrong?
>>
>> TIA,
>> Brandon
>> >>
>>
> The not registered problem is probably because you have your user profile
> application before django.contrib.auth in the installed apps list in your
> settings, simply switch these around to fix that.  The next thing you want
> to do is make sure your new user admin subclasses the old one, since the old
> one adds the password change view to the admin.
>
> Alex
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
>

Whoops, I see you're already subclassing it, ignore that part of the
message.

Alex

-- 
"I disapprove of what you say, but I will defend to the death your right to
say it." --Voltaire
"The people's good is the highest law."--Cicero

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to