I am using the create_user() function that Django provides to create my users. Also I want to store additional information about the users. So I tried following the instructions given at
but I cannot get it to work for me. Is there a step-by-step guide that I can follow to get this to work for me?
Also, once I have added these custom fields, I would obviously need to add / edit / delete data from them. I cannot seem to find any instructions on how to do this.
The recommended way is to create a new model and give it a
OneToOneField() with the built-in
User model like so:
class Student(models.Model): user = models.OneToOneField(User) college = models.CharField(max_length=30) major = models.CharField(max_length=30)
Then you can access the fields like this:
user = User.objects.get(username='jsmith') college = user.student.college