custom table for django authentication possible

320 views
Skip to first unread message

Jiss

unread,
Oct 13, 2011, 7:15:59 AM10/13/11
to Django users
I am new to django. Can I use my own table (say) 'User' instead of
'auth_user' table (keeeping all other tables for django
authentication ) ?.

Benedict Verheyen

unread,
Oct 13, 2011, 10:41:12 AM10/13/11
to django...@googlegroups.com

Why would you want to do that?
Keep everything standard and put the fields you want in a UserProfile
of your own where you store the extra information.
See the django doc:
https://docs.djangoproject.com/en/dev/topics/auth/#storing-additional-information-about-users

Cheers,
Benedict

Kurtis Mullins

unread,
Oct 13, 2011, 10:49:49 AM10/13/11
to django...@googlegroups.com
Django's User Authentication Module is pretty dependent upon it's set of assumption, including that the User data would be stored in a specific table. Without any experience in this matter, I would assume it'd be a difficult task to try to modify it to use your own table. However, you can write your own Authentication Backend. Or, you could just do like Benedict mentioned and create a one-to-one relationship with your own UserProfile if you simply want to extend the User class. Also, check out 3rd party Authentication Backends. This stuff is documented really well in the Python Docs. Also, feel free to check out Python's source code directly.


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


Jisson Varghese

unread,
Oct 19, 2011, 2:36:54 AM10/19/11
to django...@googlegroups.com
I want to do this since,The project I am handling(my first web project) is a mobile version of a project ,there is already a user table in our serverside.So avoid redundancy ,am not able to create a new table for users.

Kurtis Mullins

unread,
Oct 19, 2011, 3:28:39 AM10/19/11
to django...@googlegroups.com
Ahh okay. Yeah -- you'll most likely need to write your own custom authentication backend to use the existing table.

https://docs.djangoproject.com/en/1.3/topics/auth/#writing-an-authentication-backend

Good luck!
Reply all
Reply to author
Forward
0 new messages