I have 2 models like this:
class User(MP_Node):
login = models.CharField(max_length=32, unique=True)
password = models.CharField(max_length=128)
class Parent(User):
fname = models.CharField(max_length=32)
fmobileno = models.CharField(max_length=16)
foccupation = models.CharField(max_length=16)
fannual_income = models.FloatField()
Now I save a new Parent like that:
parent = Parent()
user = User.objects.get(login='root')
parent.user_ptr = user.add_child()
parent.login = registration_form.cleaned_data.get('login')
parent.password = registration_form.cleaned_data.get('password')
parent.password = hashlib.md5(parent.password.encode('utf-8')).hexdigest()
parent.fname =registration_form.cleaned_data.get('fname')
parent.fmobileno =registration_form.cleaned_data.get('fmobileno')
parent.foccupation =registration_form.cleaned_data.get('foccupation')
parent.fannual_income =registration_form.cleaned_data.get('fannual_income')
but I get error
Column 'depth' cannot be null
Are there any one know how to save a new Parent into database?
Thank you so much!