简体   繁体   中英

Django-registration combine databases

I've installed the django-registration app succesfully and it works great.

But now I want that when people are logged in, they have to fill in more data about theirself.

Do I need to create an new django-app, so with a new database, or is it possible to save the data in the djano-registration app database (the database with username, password and e-mail)?

And how should I link these two databases, so everybody have his own, unique "index"-page with correct 'place'/link in/to the database?

Thanks a lot!

Look at the User-Profiles section of the auth application. It explains how to create a Profile object (basically a new table, not database), that is connected to the User object, and has whatever data you add to it. It can be retrieved with get_profile() .

Just to highlight something in the docs - get_profile() does not automatically create a Profile for you, you need to manually create one each time a User is created. This Answer gives sample code for using Signals to create a profile - after a User is created, it sends a signal to any registered process. You would need to code, and register a profile-creation function with the signal.

The author of django-registration has also done a nice profile app. Wrapping around the User-Profiles.

Check it out at:

https://bitbucket.org/ubernostrum/django-profiles/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM