Hi,

i'm having some problems with the following.

Set-Up:
I am extending the User Model with inheritance just as descirbed
here:
http://scottbarnham.com/blog/2008/08/21/extending-the-django-user-model-with-inheritance/
I think it is working pretty well since it is pretty powerfull and
authentication and so on works fine. My extended Model is called
"user_extra_data".

Problem:
The only problem I am having is that if you create a new user in the
contrib.admin with the "user_extra_data" you can not just simply add a
plain password twice just as in the regular "User" section, but get
only one field with the notice "Use '[algo]$[salt]$[hexdigest]' or use
the change password form.". Fair enough, there is link with "change
password form" that links to /admin/user_extra_data/customuserdata/add/
password/ but throws a "Warning: Truncated incorrect DOUBLE value:
'add/password'". Because non technical persons shall also add
passwords later, it is no solution to create the password hashes by
hand.

What not worked out:
Actually there has been a ticket for this. 
http://code.djangoproject.com/ticket/8916
But I was not able to get the stuff running. Changing
"admin.ModelAdmin" to "UserAdmin" has not worked out, since I get an
Error: "ImproperlyConfigured: 'CustomUserDataAdmin.fieldsets[2][1]
['fields']' refers to field 'titel' that is missing from the form".

Simplified Code (left out a lot of hopefully irrelevant parts):

models.py in user_extra_data

from django.db import models
from django.contrib.auth.models import User, UserManager

class CustomUserData(User):

        # New Extra Data being saved with every User
        titel = models.CharField(max_length = 20, blank=True)
        SEX_CHOICE = (
                                                        ('Male','Mr'),
                                                        ('Female','Mrs'),
        )
        sex = models.CharField(max_length = 5, choices = SEX_CHOICE)
        last_change_date = models.DateTimeField(auto_now=True, )

        # Use NewUserManager to get the create_user method
        objects = NewUserManager()


------------------------------------------------------

admin.py in user_extra_data

from django.contrib.auth.admin import UserAdmin
from django.contrib import admin
from user_extra_data.models import CustomUserData

class CustomUserDataAdmin(UserAdmin):
        fieldsets = [
                (None,  {'fields': ('titel', 'sex', 'first_name', 'last_name',
'password')}),
                ('More',        {'fields': ('username', 
'date_joined','last_login',
'is_staff','is_active', 'is_superuser', 'groups', 'user_permissions'),
'classes': ('collapse',)}),
        ]
        prepopulated_fields = {"username": ("last_name", "first_name",)}
        radio_fields = {"sex": admin.HORIZONTAL}

admin.site.register(CustomUserData, CustomUserDataAdmin)

--~--~---------~--~----~------------~-------~--~----~
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