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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---