hi there,
I wanna build a user portal for my website. When a user log in, it can
modify it's profile in this portal. I have already followed "https://
docs.djangoproject.com/en/1.3/topics/auth/" and created a class named
UserProfile with "AUTH_PROFILE_MODULE = 'xxxxxxxx.UserProfile' in
settings.py. I also added
[code]
def create_user_profile(sender, instance, created, **kwargs):
        if created:
                UserProfile.objects.create(user = instance)

post_save.connect(create_user_profile, sender = user)
[/code]
at the end of models.py.
But this script cannot work well. When I add a user in admin site, a
error would raise with
[code]
IntegrityError at /admin/auth/user/add/

column User_id is not unique

Request Method:         POST
Request URL:    http://localhost:8000/admin/auth/user/add/
Django Version:         1.3.1
Exception Type:         IntegrityError
Exception Value:

column User_id is not unique

Exception Location:     /home/bear/work/django/djangoenv/lib/python2.7/
site-packages/Django-1.3.1-py2.7.egg/django/db/backends/sqlite3/
base.py in execute, line 234
Python Executable:      /home/bear/work/django/djangoenv/bin/python
Python Version:         2.7.2
Python Path:

['/home/bear/work/django/ciscoaaa',
 '/home/bear/work/django/djangoenv/lib/python2.7/site-packages/
distribute-0.6.15-py2.7.egg',
 '/home/bear/work/django/djangoenv/lib/python2.7/site-packages/pip-1.0-
py2.7.egg',
 '/home/bear/work/django/djangoenv/lib/python2.7/site-packages/
Django-1.3.1-py2.7.egg',
 '/home/bear/work/django/djangoenv/lib/python2.7',
 '/home/bear/work/django/djangoenv/lib/python2.7/plat-linux2',
 '/home/bear/work/django/djangoenv/lib/python2.7/lib-tk',
 '/home/bear/work/django/djangoenv/lib/python2.7/lib-old',
 '/home/bear/work/django/djangoenv/lib/python2.7/lib-dynload',
 '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-linux2',
 '/usr/lib/python2.7/lib-tk',
 '/home/bear/work/django/djangoenv/lib/python2.7/site-packages']

Server time:    Wed, 28 Sep 2011 20:16:02 +0800
[/code]


BTW: I wanna make a user portal which allow users to modify their
profiles by themselves. Can I use Admin Site to do this? Or I have to
write a brand-new web page for this? Thanks.

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