I am building a calendar and appointment website in Django. I want each user to have their own database. I want to know firstly how do I create and save user details and then how do I attach each user to their database??
Thanks in advance.
To attach multiple databases/users, you just need to specify them in the settings.py, see https://docs.djangoproject.com/en/1.9/topics/db/multi-db/.
If you want to create initial data for each users and for each database, you need to use the fixtures, see https://docs.djangoproject.com/en/1.8/howto/initial-data/
Related
I'm a newbie to the django framework and trying to make a watchlist for stocks. I've already made the crux of the webapp, where-in, a user can search for a quote and add it to their watchlist, along with relevant data about that quote.
What I want to do now is, to save the separate watchlists that different users are creating (after creating an account on my site) and upon logging in to my site, they can view their personalized watchlist and edit it.
I'm using a model for storing the data for the watchlist quotes and looking for a way to provide the different personalized watchlists depending upon the logged in user.
Can anyone give me a lead on how to employ the logic for this? Do I need to use two data bases - one for the data of the users and the other one for storing the respective user watchlists? If yes, how do I connect everything?
EDIT: Ever used a stock investment app? The way every user/customer can log in to their account and make/edit and save their watchlists in the app - that is the functionality I want to implement. How/Where do I store so many watchlists?
use 'request.user' from your view, to know the user who sent the request and return the corresponding watchlist
Is it possible to add multiple admins in Django's admin panel and how I will register them(they need to have the same rights)? And also is it possible to add another 2 roles to the panel with different rights?
I read a lot about it and can't find the answer.
I will really appreciate your help!
You can just create/modify a user and while creating a user you can select their role if they are admin, staff, etc. You can also customize user's permissions when you create their account or if the accounts are already created you can modify it.
To avoid having to assign permission's again and again, i would suggest you create a new group and add the permission that the user in that group should have and then assign the desired user in that group.
I am newbie and I really need help in this problem.
Can someone answer this and teach me how to do it in Django.
I want to create a restaurant system which has 4 types of users (admin, customer, kitchen, and cashier) in Django. I already created MySQL user database by using Wamp Server. Meanwhile, I want to create a different views for each users. Is it possible to retrieve the data from MySQL for user login purpose and assign the different views for user login page in Django?
I really need the helps. Thank you.
Hi I am creating a django application where I wanted to save some dictionaries for each log in session of a user.I am saving these dictionaries in django Sessions. Now I need to associate these sessions with the user like the following. When the user logs in a list of his past sessions should be shown and he can either select to load one of them or create a new session. When he logs out he is asked whether save current session or not. What is the best way to achieve this?
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/