I need to programmatically add a new user to a Django setup from a 3rd party platform (PHP) and it seems that I only need to write a single entry in the auth_user table to achieve this.
Am I correct? Do I need to do something else also?
Thanks!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This will work, assuming you don’t mind re-implementing the things that Django does for you; particularly hashing the password, but possibly also creating a
UserProfileobject as Ignacio suggests. You’d also need to work out another solution for code relying onpost_saveorpre_savesignals in your project (if there is any).You haven’t explained why you want to do things this way: what is dictating that you can’t have any inter-process communication apart from shared access to an SQL database?
If you can do things differently, it might make more sense to set up a localhost-only API endpoint to create users, either using the included
UserCreationFormor thecreate_user()helper method.