1

I've got one problem, I've got model:

class Student (User):    
    student_number = models.IntegerField()

then I do:

user = Student()
#some code here
user.last_name = 'last_name'
user.student_number = 22

and after calling save method:

user.save()

only field last_name is changed, but after calling:

user.student.save()

only field student_number is changed... Both methods doesn't work... So, how to update it in correct way?

0

1 Answer 1

2

That's not possible. If you are just inheriting the model then, you have all the attributes inside it and calling the save method directly would have saved it provided you have not overrode the save method in a wrong way. I mean to say,

user.save()

Should have had worked fine. May be you are doing some mistake somewhere please check it out. Otherwise, post the code which you have commented right now.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.